go_router_devtools 0.1.0
go_router_devtools: ^0.1.0 copied to clipboard
go_router adapter for the navigation_devtools DevTools extension — live backstack, route tree, and interactive navigation for GoRouter apps.
go_router_devtools #
go_router adapter for the navigation_devtools DevTools panel: live backstack (including ShellRoute nesting), the full route tree with redirect badges, path/query params and extra previews, and confirm-gated go/pushNamed/pop from the panel.
Setup #
import 'package:go_router_devtools/go_router_devtools.dart';
import 'package:navigation_devtools/navigation_devtools.dart';
void main() {
final router = GoRouter(routes: [...]);
NavigationDevTools.register(GoRouterAdapter(router));
runApp(MaterialApp.router(routerConfig: router));
}
Run your app and open the navigation_devtools tab in Flutter DevTools. (The panel ships inside the navigation_devtools dependency — nothing else to install.)
What you get #
- Live stack from the router delegate's
RouteMatchList, with shell routes shown as nested entries. - Route tree from
configuration.routes; routes with aredirectcallback get aredirectbadge (redirects are closures, so only their presence can be shown). - Interactive navigation: navigate by path (
go), push by route name, and pop — each behind a confirm dialog.
Dialogs & bottom sheets #
showDialog/showModalBottomSheet are pageless routes on the raw Navigator — GoRouter's route matches never include them. To see them in the panel, pair this adapter with a Navigator1Adapter observer on the same router:
final pageless = Navigator1Adapter(label: 'Pageless routes');
final router = GoRouter(observers: [pageless.observer], routes: [...]);
NavigationDevTools.register(GoRouterAdapter(router));
NavigationDevTools.register(pageless);
The panel then shows both views in its router selector.
Version compatibility #
Depends on go_router ^16.0.0 (pinned against 16.3.0 internals: RouteMatchList, ShellRouteMatch). The adapter's contract is enforced by the navigation_devtools conformance kit in this package's tests.
Release builds #
Registration is a hard no-op under kReleaseMode.