fix rout state issue

This commit is contained in:
Fabian Freund
2026-02-08 17:37:34 +01:00
parent d1e769fb7c
commit fec33aa694
2 changed files with 9 additions and 8 deletions
+8 -7
View File
@@ -60,23 +60,24 @@ class CurrentTopRoute extends _$CurrentTopRoute {
final router = ref.watch(routerProvider).value;
if (router == null) return null;
void update() {
GoRoute? getCurrentRoute() {
final config = router.routerDelegate.currentConfiguration;
if (config.isEmpty) {
state = null;
return;
return null;
}
final match = config.last;
state = match.route;
return match.route;
}
void update() {
state = getCurrentRoute();
}
router.routerDelegate.addListener(update);
ref.onDispose(() => router.routerDelegate.removeListener(update));
update();
return state;
return getCurrentRoute();
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ final class CurrentTopRouteProvider
}
}
String _$currentTopRouteHash() => r'1d71db42203483c7d919f44879e673f2f36d2e6a';
String _$currentTopRouteHash() => r'60bc1b11ab636ba250b891eed24f7e7dd8e62d81';
abstract class _$CurrentTopRoute extends $Notifier<RouteBase?> {
RouteBase? build();