Last active
September 25, 2022 04:34
-
-
Save andersonmendesdev/4089823570e47b74207e5f8b9df32609 to your computer and use it in GitHub Desktop.
simple bloc observer state
This file contains 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'; | |
void main() { | |
Bloc.observer = SimpleBlocObserver(); | |
runApp(const MyApp()); | |
} | |
class SimpleBlocObserver extends BlocObserver { | |
// @override | |
// void onCreate(BlocBase bloc) { | |
// super.onCreate(bloc); | |
// print('onCreate -- bloc: ${bloc.runtimeType}'); | |
// } | |
// | |
@override | |
void onEvent(Bloc bloc, Object? event) { | |
super.onEvent(bloc, event); | |
print('onEvent -- bloc: ${bloc.runtimeType}, event: $event'); | |
} | |
@override | |
void onChange(BlocBase bloc, Change change) { | |
super.onChange(bloc, change); | |
print('onChange -- bloc: ${bloc.runtimeType}, change: $change'); | |
} | |
// | |
// @override | |
// void onTransition(Bloc bloc, Transition transition) { | |
// super.onTransition(bloc, transition); | |
// print('onTransition -- bloc: ${bloc.runtimeType}, transition: $transition'); | |
// } | |
// | |
// @override | |
// void onError(BlocBase bloc, Object error, StackTrace stackTrace) { | |
// print('onError -- bloc: ${bloc.runtimeType}, error: $error'); | |
// super.onError(bloc, error, stackTrace); | |
// } | |
// | |
// @override | |
// void onClose(BlocBase bloc) { | |
// super.onClose(bloc); | |
// print('onClose -- bloc: ${bloc.runtimeType}'); | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment