onDone method
Called whenever an event
handler for a specific Bloc
has completed.
This may include an error
and stackTrace
if an uncaught exception
occurred within the event handler.
onDone
is called right after the event handler has completed.
A great spot to add logging/analytics at the individual Bloc
level.
Note: super.onDone
should always be called first.
@override
void onDone(Event event, [Object? error, StackTrace? stackTrace]) {
// Always call super.onDone with the respective event.
super.onDone(event, error, stackTrace);
// Custom onDone logic goes here
}
See also:
BlocObserver.onDone
for observing event handler completions globally.
Implementation
@protected
@mustCallSuper
void onDone(Event event, [Object? error, StackTrace? stackTrace]) {
// ignore: invalid_use_of_protected_member
_blocObserver.onDone(this, event, error, stackTrace);
}