'Flutter Bloc: Many states within a screen, how to handle?

Is it normal for me to give different states from different blocs/cubits within a screen?

For example: on one screen I have two textfields - email and password.

Email textfield has EmailBloc and there is a state to get the value of the textfield.

Password textfield has PasswordBloc and there is a state to get the value of the textfield.

The password textfield has a show/hide password button. The show/hide password button has a ShowPasswordCubit to change its state.

Thank you. I'm a bit confuse using bloc in flutter.



Solution 1:[1]

Learning by example is always a good way to go, this got me on my feet with BLoC as well as this.

Essentially, your login page should house the main BLoC where you can pass in the email and pass values via the TextEditingController instead of having a separate BLoC for every textfield/widget.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mohamed Mohamed