0

I'm new to bloc and I failed to find an example of code for my case.

In my app I have such entity as a Player and I want to manage state for both each individual Player (changing his name and score) and a list of Players (adding/removing players). I understand how I can make PlayerCubit, but as for managing a list - I don't get it.

It looks like I need something like PlayersCubit<PlayerCubit> but I'm not sure if it's right and how is this supposed to work.

So, what is the right way?

1 Answers1

0

You are on the right track in your case I would recommend having two cubits one called PlayerCubit and one called PlayersCubit.

For PlayersCubit you would have a PlayersState with the Success state having a List as opposed to just a Player object.

Hadi Hassan
  • 331
  • 1
  • 3