flow_routing library
Flow — The next-generation Flutter router.
Classes
- FakeFlowRouter
- Test double that records navigation intents without building widgets.
- FlowApp
- Convenience wrapper for MaterialApp.router with Flow.
- FlowBranchNode
- FlowGuard
- Guard that can allow, block, or redirect navigation.
- FlowLeafNode
- FlowMiddleware
- Middleware observes navigation before and after transitions.
- Observes navigator-level route changes.
- FlowOverlayEntry
- Immutable overlay entry for imperative navigation.
- FlowRedirectResult
- Result of a redirect evaluation.
- FlowRoute
- A typed route instance — no subclass needed.
- FlowRouteDefinition
- Declarative registration for a FlowRoute destination.
- FlowRouteNode
- Base for shell route definitions.
- FlowRouter
- The primary entry point for Flow routing.
- FlowRouteState
- Read-only navigation state exposed to builders and guards.
- FlowShellNode
- FlowStatefulShellController
- Controller passed to stateful shell builders.
- FlowStatefulShellNode
- FlowTransition
- Transition configuration for route pages.
- GoBranchIntent
- Switch stateful shell branch.
- GoIntent
- Replace declarative location stack.
- GuardAllow
- Allow navigation to proceed.
- GuardBlock
- Block navigation.
- GuardContext
- Context passed to guards during navigation.
- GuardRedirect
- Redirect to another route.
- GuardResult
- Result of guard evaluation.
- LocationBuilder
- Builds canonical URL locations from FlowRoute instances.
- LoggingMiddleware
- Logs navigation transitions.
- MatchEngine
- Efficient segment-based route matching engine.
- MatchResult
- Result of matching a URI against the route registry.
- MiddlewareContext
- Context for middleware hooks.
- Navigate using a route (alias for go).
- Core navigation engine — single source of truth for routing state.
- Sealed hierarchy of navigation intents.
- Result of a navigation operation.
- Complete immutable navigation state.
- Stable identifier for a Navigator within Flow.
- OverlayStack
- Stack of imperative overlay routes for a navigator.
- PopIntent
- Pop from overlay or location stack.
- PopUntilIntent
- Pop until a route is found.
- PushIntent
- Push onto overlay stack.
- RedirectGuard
- Guard that redirects when condition is true.
- ReplaceIntent
- Replace top route.
- RouteMatch
- A single matched route in the navigation tree.
- RouteMatchChain
- Ordered chain of matches from root to leaf.
- RouteRegistry
- Central registry of all route definitions.
- SetLocationIntent
- Set state from external URL.
- ShellMatch
- Match for a shell route in the tree.
Enums
- How a navigation operation affects the route stacks.
- FlowTransitionType
- ImperativeUrlPolicy
- Controls how imperative navigation affects the browser URL.
Extensions
- Navigation and router access from BuildContext.
- FlowRouteAccess on FlowRoute
- Typed accessors for FlowRoute path and query parameters.
Functions
-
applyRouteToChain(
RouteMatchChain chain, FlowRoute route) → RouteMatchChain -
Applies a typed
routeto the leaf ofchainand updates the URI. -
flow(
String pathTemplate, {required String name, required FlowRouteBuilder builder, FlowRouteFactory? factory, List< FlowGuard> guards = const [], FlowTransition transition = const FlowTransition.material(), Map<String, Object?> meta = const {}, bool restorable = true, String? pageKey}) → FlowLeafNode - Declares a leaf route — the simplest way to register a destination.
-
goRouterPathToDefinition(
{required String name, required String path, required FlowRouteBuilder builder, FlowRouteFactory? factory}) → FlowRouteDefinition - Scaffold for creating a FlowRouteDefinition from a GoRouter path.
-
migrateGoRouterPath(
String path) → String - Converts a GoRouter-style path template to a Flow path template.
Typedefs
-
FlowRedirect
= FutureOr<
FlowRedirectResult?> Function(BuildContext context, FlowRouteState state) - Redirect callback signature.
- FlowRouteBuilder = Widget Function(BuildContext context, FlowRoute route)
-
FlowRouteFactory
= FlowRoute Function(Map<
String, String> params)
Exceptions / Errors
- FlowException
- Base exception for Flow routing errors.
- FlowGuardBlockedException
- Thrown when a guard blocks navigation.
- FlowNotFoundException
- Thrown when no route matches a location.
- FlowNothingToPopException
- Thrown when popping an empty stack.
- FlowRedirectLoopException
-
Thrown when redirect evaluation exceeds
maxRedirects.