Dart&Flutter with mizu
225 subscribers
22 photos
9 videos
20 links
Download Telegram
If you are utilizing Bloc as a state management solution, it's crucial to avoid using multiple on statements in the constructor. Each on statement operates independently with its own queue and transformer without any specific order enforced. Doing so can lead to inconsistent states or race conditions.

Here are some tips for effectively handling events in Bloc:

- Try to use only one on event handler.
- Utilize pattern matching from freezed or sealed classes.
- Organize event handling using sequential transformer.
- Avoid using Cubit to handle complex state changes.

Clear explanation in comments...

#tip #bloc
3