flutter library

Classes

GuardAllow
A GuardResult that permits navigation.
GuardBlock
A GuardResult that denies navigation.
GuardContext
Immutable navigation snapshot passed to each Guard.
GuardRedirect
A GuardResult that requests navigation redirection.
GuardResult
The outcome returned by a Guard.
History
A minimal browser-like history abstraction.
HistoryEvent
A navigation event emitted by History.listen.
HistoryLocation
The current location for a History implementation.
Inlet
Flutter route declaration used by createRouter.
A tappable widget that triggers Unrouter navigation.
MemoryHistory
An in-memory History implementation.
Outlet
Renders the next matched view in the active nested route chain.
OutletScope
Inherited scope used by Outlet to resolve nested views by depth.
RouteNode<V>
Platform-agnostic route declaration.
RouteRecord<V>
Compiled route data for a matched absolute path.
RouteScopeProvider
Inherited route scope used by route hooks and Outlet.

Enums

HistoryAction
The kind of navigation that produced the current location.
HistoryStrategy
Strategies available for web history creation.
RouteScope
Aspects used by RouteScopeProvider for selective rebuilds.

Extension Types

RouteParams
Typed helpers for matched route params.
URLSearchParams
Typed helpers over ht.URLSearchParams.

Functions

createHistory({String? base, HistoryStrategy strategy = .browser}) History
Creates a History based on the current platform.
createRouter({required Iterable<Inlet> routes, Iterable<Guard>? guards, String base = '/', int maxRedirectDepth = 8, History? history, HistoryStrategy strategy = HistoryStrategy.browser}) Unrouter
Creates a Flutter router backed by core.createRouter.
createRouterConfig(Unrouter router) RouterConfig<HistoryLocation>
Builds a Flutter RouterConfig from an Unrouter instance.
defineDataLoader<T>(DataFetcher<T> fetcher, {ValueGetter<T?>? defaults}) DataLoader<T>
Creates a reusable DataLoader from a DataFetcher.
defineGuard(Guard guard) Guard
Returns the provided guard unchanged.
useFromLocation(BuildContext context) HistoryLocation?
Returns the previous accepted location, if any.
useLocation(BuildContext context) HistoryLocation
Returns the current location (URI + state) from the nearest route scope.
useQuery(BuildContext context) URLSearchParams
Returns query params from the nearest route scope.
useRouteMeta(BuildContext context) Map<String, Object?>
Returns merged route metadata from the nearest route scope.
useRouteParams(BuildContext context) RouteParams
Returns matched route params from the nearest route scope.
useRouter(BuildContext context) Unrouter
Returns the nearest Unrouter instance from a Flutter BuildContext.
useRouteState<T>(BuildContext context) → T?
Returns typed navigation state from the nearest route scope.
useRouteURI(BuildContext context) Uri
Returns the current URI from the nearest route scope.

Typedefs

DataFetcher<T> = FutureOr<T> Function(BuildContext context)
Computes a value for a BuildContext, synchronously or asynchronously.
DataLoader<T> = AsyncData<T> Function(BuildContext context)
A context-aware async data producer used by Unrouter widgets.
Guard = FutureOr<GuardResult> Function(GuardContext context)
Evaluates whether a navigation attempt should continue.
HistoryListener = void Function(HistoryEvent event)
RouterListener = void Function()
Listener used by Unrouter adapters to observe accepted location changes.
Unrouter = Unrouter<Widget>
Flutter-specialized Unrouter type alias.
ViewBuilder = ViewBuilder<Widget>
Builds a widget for a matched route view.