onError method Null safety
- Object error,
- StackTrace stackTrace
override
Called whenever an error occurs and notifies BlocObserver.onError.
Note: super.onError should always be called last.
@override
void onError(Object error, StackTrace stackTrace) {
// Custom onError logic goes here
// Always call super.onError with the current error and stackTrace
super.onError(error, stackTrace);
}
Implementation
@override
void onError(error, stackTrace) {
// TODO: implement analytics here
log("$runtimeType - error", error: error, stackTrace: stackTrace);
super.onError(error, stackTrace);
}