这里的警告是为了警告您,当状态被销毁时,Riverpod既不会监听ChangeNotiator,也不会处理它(如果您使用ChangeNotifierProvider
,就会发生这种情况).
If you do not care about these points, you can safely ignore the lint.
I'd recommend disposing the notifier manually as followed:
@riverpod
// ignore: unsupported_provider_value
GoRouter example(ExampleRef ref) {
final router = GoRouter(...);
ref.onDispose(router.dispose);
return router;
}