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
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.
2
Answers
I have found the solution while playing around!
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.