Flutter package · v3.4

One route table. One or two columns.

Declarative adaptive routing for Flutter: a URL maps to a page stack, shown as a classic Navigator on narrow windows and as sliding two-column panes on wide ones. Call sites look like Navigator.

dart
final router = AdaptiveRouter.of(context);
router.pushNamed('/mail/inbox');
router.pushNamed(
  router.namedLocation('thread',
      pathParameters: {'folder': 'inbox', 'threadId': '42'}),
  arguments: thread,
);
router.pop();

Why this package

One route table

AdaptiveRouter + MaterialApp.router. Every page lives in the table, so the URL can always express the stack.

URL is the stack

Back, deep links and refresh all take the same path. Web uses hash URLs, so GitHub Pages needs no 404 fallback.

1 or 2 columns

Below 840 px a Navigator; at or above it the last two pages slide side by side with a resizable sash and breadcrumbs.

Navigator verbs

pushNamed, pop, maybePop, pushReplacementNamed… with the same names and signatures as NavigatorState.