2023-01-08 22:27:33 -05:00
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'loggy.dart';
|
|
|
|
|
|
|
|
class StateLogger extends ProviderObserver {
|
|
|
|
const StateLogger();
|
|
|
|
@override
|
|
|
|
void didUpdateProvider(
|
2023-07-26 15:58:38 -04:00
|
|
|
ProviderBase<Object?> provider,
|
2023-01-08 22:27:33 -05:00
|
|
|
Object? previousValue,
|
|
|
|
Object? newValue,
|
|
|
|
ProviderContainer container,
|
|
|
|
) {
|
2023-07-26 15:58:38 -04:00
|
|
|
log.debug('''
|
|
|
|
{
|
2023-01-08 22:27:33 -05:00
|
|
|
provider: ${provider.name ?? provider.runtimeType},
|
|
|
|
oldValue: $previousValue,
|
|
|
|
newValue: $newValue
|
|
|
|
}
|
|
|
|
''');
|
|
|
|
super.didUpdateProvider(provider, previousValue, newValue, container);
|
|
|
|
}
|
|
|
|
}
|