123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import 'package:flutter_riverpod/flutter_riverpod.dart';
- import 'package:shared/utils/log_utils.dart';
- class MyRiverpodObserver extends ProviderObserver {
- @override
- void didAddProvider(
- ProviderBase<Object?> provider,
- Object? value,
- ProviderContainer container,
- ) {
- Log.d('Riverpod Provider Did Add -> $provider was initialized with $value');
- }
- @override
- void didDisposeProvider(
- ProviderBase<Object?> provider,
- ProviderContainer container,
- ) {
- Log.d('Riverpod Provider Did Dispose -> $provider was disposed');
- }
- @override
- void didUpdateProvider(
- ProviderBase<Object?> provider,
- Object? previousValue,
- Object? newValue,
- ProviderContainer container,
- ) {
- Log.d(
- 'Riverpod Provider Did Update -> $provider updated from $previousValue to $newValue',
- );
- }
- @override
- void providerDidFail(
- ProviderBase<Object?> provider,
- Object error,
- StackTrace stackTrace,
- ProviderContainer container,
- ) {
- Log.d('Riverpod Provider Did Fail -> $provider threw $error at $stackTrace');
- }
- }
|