Created
August 14, 2020 07:58
-
-
Save dllewellyn/b4c6b6925446f354faba90f4ad6af408 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:bloc/bloc.dart'; | |
| class FluttersaurusBlocObserver extends BlocObserver { | |
| @override | |
| void onEvent(Bloc bloc, Object event) { | |
| print('${bloc.runtimeType} $event'); | |
| super.onEvent(bloc, event); | |
| } | |
| @override | |
| void onTransition(Bloc bloc, Transition transition) { | |
| print('${bloc.runtimeType} $transition'); | |
| super.onTransition(bloc, transition); | |
| } | |
| @override | |
| void onChange(Cubit cubit, Change change) { | |
| if (cubit is! Bloc) { | |
| print('${cubit.runtimeType} $change'); | |
| } | |
| super.onChange(cubit, change); | |
| } | |
| @override | |
| void onError(Cubit cubit, Object error, StackTrace stackTrace) { | |
| print('${cubit.runtimeType} $error $stackTrace'); | |
| super.onError(cubit, error, stackTrace); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment