I'm relatively new to Flutter and the BLoC pattern, so I'm still trying to wrap my head around everything.
Let's say I have a quiz app where I have a BLoC called QuestionBloc
which uses a repository to fetch questions from a file.
Event on QuestionBloc
FetchQuestion
States on QuestionBloc
QuestionEmpty
QuestionLoading
QuestionLoaded
which contains a question objectQuestionError
I then have another BLoC called QuestionValidatorBloc
which is responsible for validating the answers to the question. The answer is entered into a text field and there is a submit button to trigger the validation.
Event on QuestionValidatorBloc
ValidateQuestion
States on QuestionValidatorBloc
ValidateInitial
ValidateInProgress
ValidateSuccess
ValidateError
This is fairly straight forward. However, now I need to incorporate both QuestionBloc
and QuestionValidatorBloc
into the same widget since one of them is responsible for fetching and displaying the question and the other for handling the validation action. How can I achieve this?
validation
andapi call
is absolutely different job, I don't know why use one is better adoption. – Arron