Flutter BLoC multiple BLoCs same widget. I assumed you are using the flutter_bloc library. Let the QuestionBloc listen to the QuestionValidatorBloc using StreamSubscription:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | class QuestionBloc extends Bloc<QuestionEvent, QuestionState> { QuestionValidatorBloc questionValidatorBloc; StreamSubscription subscription; MainPageBloc({@required this.questionValidatorBloc}) { subscription= questionValidatorBloc.state.listen((state) { if (state is ValidateSuccess) { dispatch(YourEvent()); } else if(state is ValidateError{ dispatch(AnotherEvent()); } }); } ... |
Now you just have to pass the QuestionValidatorBloc to the QuestionBloc constructor.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.