skip to Main Content

Just start with bloc and looking for improvement.
I wonder if I did it okay here, Because I don’t know which state should I Emit.
it is not update when I add or remove item from list

My Cubit Class

2

Answers


  1. Chosen as BEST ANSWER

    I have found the solution while playing around!

    Updated


  2. Bloc triggers a state update whenever the old state does not equal the new one.
    Just adding or removing an item to a list is not enough.

    To achieve this you can either use the package equatable or manually override the equals method of your state class (the first way is cleaner and more secure).

    I also suggest to take a look at the official documentation for the bloc library for state changes.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search