mirror of
https://github.com/lucavenir/go_router_riverpod.git
synced 2025-08-06 14:59:53 +08:00
26 lines
621 B
Dart
26 lines
621 B
Dart
// ignore_for_file: strict_raw_type
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
/// Useful to log state change in our application
|
|
/// Read the logs and you'll better understand what's going on under the hood
|
|
class StateLogger extends ProviderObserver {
|
|
const StateLogger();
|
|
@override
|
|
void didUpdateProvider(
|
|
ProviderBase provider,
|
|
Object? previousValue,
|
|
Object? newValue,
|
|
ProviderContainer container,
|
|
) {
|
|
debugPrint('''
|
|
{
|
|
provider: ${provider.name ?? provider.runtimeType},
|
|
oldValue: $previousValue,
|
|
newValue: $newValue
|
|
}
|
|
''');
|
|
}
|
|
}
|