dartway_router 1.1.2
dartway_router: ^1.1.2 copied to clipboard
Opinionated wrapper around go_router that makes routing explicit, predictable, and scalable for real-world Flutter apps.
1.1.2 - 2026-08-19 #
Fixed #
isActive no longer answers false for the route that is open.
The check compared the router template against the current address, so
a route with a parameterized segment anywhere in its chain never matched:
/project/:projectId/issues was compared with /project/7/issues and the
method answered "not active" without a warning — a navigation item simply
never lit up. Path parameters are now taken from
GoRouterState.pathParameters and the comparison runs per path segment.
The semantics around it are unchanged: a route stays active while a descendant
of it is open (a parent tab keeps its highlight on a nested page), a route is
not active merely because its path is a string prefix of the location (/news
at /newsletter), and a zone root with an empty path is active at its own
address only.
Changed #
A duplicate route name now says which zones declare it.
Route names are global: DwRouter keeps one registry for the whole app and
resolves every route by name. An enum, though, gives its values a namespace of
their own, so two zones each declaring projects compile without a word — and
the failure surfaced far from the declaration, in the first screen that touched
the router. The check itself was there, but it reported the bare name and left
both declarations to be found by hand; worse, when the two zones also collided
on the path (the usual case) the path check ran first, and its message named
neither the route nor the zone.
The name check now runs ahead of the path check — a shared name is the cause, the shared path its symptom — and the failure carries the whole story:
Duplicate route name "projects".
Declared by:
- AppNavigationZone.projects (navigationZones[0])
- AdminNavigationZone.projects (navigationZones[1])
Route names are global across navigation zones. DwRouter keeps a single
registry for the whole app and resolves routes by name, so a name may be
declared once and only once. ...
Duplicate paths and invalid paths are reported the same way, naming the enum
value and the position of its zone in navigationZones.
1.1.1 - 2026-07-12 #
Fixed #
Pushing the same route twice no longer crashes the Navigator.
Page keys were derived from the route name and path
(ValueKey('$name-$path')), so two entries for the same location on the stack
shared a key and tripped the Navigator's _debugCheckDuplicatedPageKeys
assertion. Pages now use go_router's own state.pageKey, which is unique per
stack entry (a fresh key for every imperative push, preserved across rebuilds).
Covered by a regression test: pushing profile twice must not throw.
1.1.0 - 2026-05-22 #
⚠️ Breaking Change #
Route enums implementing DwNavigationRoute must add the new abstract getter.
The compiler will tell you exactly which enums need it:
@override
DwStatefulShellRouteBuilder? get statefulShellRouteBuilder => null;
Added #
-
statefulShellRouteBuilderonDwNavigationRoute— wraps the zone in aStatefulShellRoute.indexedStackwhere every root route is an independent navigation branch. Each branch keeps its own navigator stack, so scroll position, sub-routes and widget state survive tab switches. The builder receivesStatefulNavigationShellinstead of a plain child widget: usenavigationShell.currentIndexfor the active tab index andnavigationShell.goBranch(i, initialLocation: ...)to switch tabs. Prefer this overshellRouteBuilderfor any bottom-navigation-bar layout. -
DwGoRouterOptions.onEnter(OnEnter?, defaultnull) — intercepts every navigation event before routes are matched. ReturnAllow()to proceed,Block.stop()to cancel, orBlock.then(cb)to cancel and run a follow-up action (e.g. redirect). Executes beforeredirectandzoneGuards. Wraps theOnEnterAPI introduced in go_router v14. -
DwGoRouterOptions.caseSensitive(bool, defaulttrue) — controls case-sensitivity for all route paths built byDwRouter. Set tofalseif you need/Profileand/profileto resolve to the same route. Wraps the per-routecaseSensitiveflag introduced in go_router v15. -
DwGoRouterOptions.shellNotifyRootObserver(bool, defaulttrue) — controls whetherShellRoute/StatefulShellRoutezones fire root navigator observer callbacks during inner navigations. Set tofalseto suppress them, e.g. when root observers track page views and you don't want tab-level nav counted. WrapsnotifyRootObserverfrom go_router v14.
Changed #
go_routerconstraint bumped to^17.2.3.flutter_lintsbumped to^6.0.0.- Both bundled examples (
change_notifier_example,riverpod_example) migrated fromshellRouteBuildertostatefulShellRouteBuilder. Bottom nav tab state is now preserved across switches; the manualrootRouteFromStateindex lookup is replaced bynavigationShell.currentIndex. DwNavigationRoutemember order standardised:descriptor→zoneRoot→shellRouteBuilder→statefulShellRouteBuilder→zoneGuards.- Both examples now target web only (iOS folders removed).
Fixed #
DwPageBuilder.slide: thefromparameter now correctly describes the entry direction.from: AxisDirection.rightnow slides the page in from the right edge (previously the offset was inverted — pages entered from the opposite side).READMEexample used non-existentAxisDirection.bottom; corrected toAxisDirection.down.
1.0.1 1.0.2 #
Updated readme, examples and pubspec.yaml for better pub.dev representation.
1.0.0 #
Initial public release.