BlocBuilder handles building a widget in response to new states.
BlocBuilder is analogous to StreamBuilder but has simplified API to
reduce the amount of boilerplate code needed as well as bloc-specific
Please refer to BlocListener if you want to "do" anything in response to
state changes such as navigation, showing a dialog, etc... [...]
Takes a BlocWidgetListener and an optional bloc and invokes
the listener in response to state changes in the bloc.
It should be used for functionality that needs to occur only in response to
a state change such as navigation, showing a SnackBar, showing
a Dialog, etc...
The listener is guaranteed to only be called once for each state change
unlike the builder in BlocBuilder. [...]
Takes a Create function that is responsible for
creating the Bloc and a child which will have access
to the instance via BlocScope.of(context).
It is used as a dependency injection (DI) widget so that a single instance
of a Bloc can be provided to multiple widgets within a subtree. [...]
Signature for the buildWhen function which takes the previous state and
the current state and is responsible for returning a bool which
determines whether to rebuild BlocBuilder with the current state.
Signature for the listenWhen function which takes the previous state
and the current state and is responsible for returning a bool which
determines whether or not to call BlocWidgetListener of BlocListener
with the current state.