flow_routing 2.0.0
flow_routing: ^2.0.0 copied to clipboard
The next-generation Flutter router. Typed routes, pipeline guards, first-class web support, and performance built from first principles.
2.0.0 #
Instance-based routing — no route classes required.
Breaking changes #
FlowRouteis now a concretefinal class— define route instances instead of subclassesFlowRouteDefinitionis no longer generic;factoryis optional (auto-generated from path params)goRouterPathToDefinitionno longer takes a type parameter
New API #
flow()top-level helper for concise route registrationFlowRouteAccessextension:pathParam,intPathParam,queryParam,isNameFlowRoute.isName()for guard checks withoutistype testsFlowRoute.copyWith()and optionalextrapayload
Performance (120+ FPS target) #
- Multi-level route trie — O(depth) candidate lookup instead of O(routes) for shared prefixes
- MatchEngine scratch buffers — zero per-match list/map allocation on hot path
matchLeaffast path — typedcontext.flow()skips full tree scan (O(1) name lookup)- Page cache — reuses unchanged
Pageinstances whenpageKey/ location is stable - Location caching —
FlowRoute.locationandNavigationState.locationcomputed once - URL sync skip — platform URL updated only when URI actually changes
- Sync guard/middleware fast path — no microtask overhead for synchronous guards
- Single
FlowRouterScope— removed per-page inherited notifier overhead
Navigation API #
context.flow(route)— unified go navigationcontext.flow(route, push: true)— overlay pushcontext.flowNamed(name, ...)— goNamed / pushNamed equivalentcontext.pop()— pop overlay or history
Example #
context.flow(Routes.user(id: 42));
context.flow(Routes.about, push: true);
context.pop();
1.0.3 #
- add benchmark image to README for performance tracking.
1.0.2 #
- Add segment-indexed route matching for faster lookups on large route trees
- Cache route definitions by name in
RouteRegistryfor O(1) lookup - Gate
LoggingMiddlewareoutput behindkDebugModefor production builds - Harden CI with format checks and example app analysis
- Tighten analyzer rules and Flutter SDK constraint (
>=3.12.0)
1.0.1 #
- fix lint issues, and clean up imports across the codebase
1.0.0 #
Flow Routing (flow_routing on pub.dev) is production-ready.
Core Router #
- Typed
FlowRoutesystem with automatic URL generation (.location) FlowRouterwith Navigator 2.0 integration viaFlowApp.router- Navigation intents:
go,push,pop,replace,popUntil,goBranch - Separated declarative location stack and imperative overlay stacks
- Segment-based
MatchEnginewith path parameters and query support
Guards & Middleware #
FlowGuardpipeline withGuardAllow,GuardBlock,GuardRedirectRedirectGuardfor common auth patternsFlowMiddlewarewithLoggingMiddleware
Web #
FlowRouteInformationParserandFlowRouteInformationProviderImperativeUrlPolicyfor URL synchronization control- Refresh-safe URL parsing
Shell Routes #
FlowShellNodefor nested navigationFlowStatefulShellNodefor tab-based branch navigation
Transitions #
FlowTransition.material,.fade,.slide,.none
Testing #
FakeFlowRouterfor intent recording- Unit tests for matcher, engine, location builder
- Widget tests for
FlowApp
Migration #
goRouterPathToDefinitionandmigrateGoRouterPathhelpers
Example #
- Beautiful Material 3 demo app with auth guards, typed user routes, and web support
Documentation #
- Getting Started, API Reference, Cookbook, Migration Guide, Architecture
0.1.0 #
- Phase 1: Architecture proposal and GoRouter issue analysis