onTransition method
Called whenever a transition occurs in any bloc
with the given bloc
and transition
.
A transition
occurs when a new event
is added
and a new state is emitted
from a corresponding EventHandler
.
onTransition is called before a bloc
's state has been updated.
Implementation
@override
@mustCallSuper
void onTransition(Bloc bloc, Transition transition) {
super.onTransition(bloc, transition);
if (!settings.enabled || !settings.printTransitions) {
return;
}
final accepted = settings.transitionFilter?.call(bloc, transition) ?? true;
if (!accepted) {
return;
}
_talker.logCustom(BlocStateLog(
bloc: bloc,
transition: transition,
settings: settings,
));
}