wouter library

Classes

MatchData
Represents the result of a successful route path match.
PathMatchers
A utility class providing factory methods for creating PathMatcher instances.
RegexpData
A data class that holds a compiled regular expression (RegExp) and a list of parameter names extracted from the original route pattern.
Replace
A widget that declaratively performs a "replace" navigation action when it is inserted into the widget tree.
ReplaceUntil
A widget that declaratively performs a "replace until" navigation action when it is inserted into the widget tree.
Reset
A widget that declaratively performs a "reset" navigation action when it is inserted into the widget tree.
RouteEntry<T>
Represents an entry in the Wouter navigation stack.
StackPolicy
Defines a policy for managing the navigation stack in Wouter.
Wouter
A widget that establishes a nested Wouter routing scope with a specific base path.
WouterActionsScope
A widget that allows descendant widgets to register interceptor callbacks for Wouter's push and pop navigation actions.
WouterListenable<T extends Listenable>
A widget that synchronizes a Flutter Listenable (e.g., a TabController, PageController, or custom ChangeNotifier) with Wouter's navigation state.
WouterNavigator
A navigator widget that manages a stack of child routes based on the Wouter navigation state from a parent Wouter context.
WouterNavigatorState
The state for WouterNavigator.
WouterPage
A widget that synchronizes a PageController (and by extension, typically a PageView) with Wouter's navigation state.
WouterRouteInformationParser
A RouteInformationParser for the Wouter routing package.
WouterRouterDelegate
The core RouterDelegate for the Wouter routing system.
WouterSelector
A selector class that provides convenient access to Wouter's core components like WouterStateStreamable, the current WouterState, the Stream of state changes, and WouterActions.
WouterState
Represents the current state of the Wouter router.
WouterStateStreamable
An abstract class providing access to the current WouterState both synchronously via the state getter and asynchronously via the stream.
WouterSwitch
A widget that displays one of a set of child widgets based on the current Wouter navigation path.
WouterTab
A widget that synchronizes a TabController (and typically a TabBar and TabBarView) with Wouter's navigation state.

Mixins

WouterParentMixin<T extends StatefulWidget>
A mixin for State classes that need to access and react to the WouterStateStreamable provided by a parent Wouter scope.

Extensions

PopCountWouterActionExtension on WouterAction
Extends WouterAction with a convenient method to pop multiple routes from the navigation stack at once.
PopUntilWouterActionExtension on WouterAction
Extends WouterAction with a method to pop routes from the navigation stack until a route satisfying a given predicate is reached.
PopWouterActionExtension on WouterAction
Extends WouterAction with a simplified method for popping the current route.
PushWouterActionExtension on WouterAction
Extends WouterAction with a convenient method for pushing a new route onto the navigation stack.
ReplaceUntilWouterActionExtension on WouterAction
Extends WouterAction with a method to replace a segment of the navigation stack with a new route.
ReplaceWouterActionsExtension on WouterAction
Extends WouterAction with methods to replace the current route with a new one.
ResetWouterActionExtension on WouterAction
Extends WouterAction with methods to reset the navigation stack to a specified new stack of routes.
WouterBuildContextExtensions on BuildContext
Provides convenient extension methods on BuildContext for accessing Wouter's core functionalities like state, streams, and actions.
WouterStateFullPathExtension on WouterState
Extension on WouterState to provide convenient access to the full, absolute path of the currently active route.
WouterStatePathExtension on WouterState
Extension on WouterState to provide convenient access to the path of the currently active route.

Functions

cache(PathMatcher builder) PathMatcher
Creates a cached version of a PathMatcher.
cacheRegexpBuilder(RegexpBuilder builder) RegexpBuilder
Creates a cached version of a RegexpBuilder.
pathToRegexp(String pattern, {bool caseSensitive = false, bool prefix = false}) RegexpData
A RegexpBuilder that converts a route pattern string (like "/users/:id") into RegexpData, which includes the compiled RegExp and a list of extracted parameter names.
regexpPathMatcher(String path, String pattern, {RegexpBuilder regexpBuilder = pathToRegexp, bool prefix = true}) MatchData?
A PathMatcher implementation that uses regular expressions to match a path against a pattern.

Typedefs

ActionBuilder = ({PathBuilder pathBuilder, PopAction pop, PushAction push})
A record type that bundles core navigation actions and utilities.
CreateListenable<T> = T Function(BuildContext, int)
A function that creates and returns a listenable object of type T.
DisposeListenable<T> = void Function(BuildContext, T)
A function responsible for disposing of a listenable object T when it's no longer needed.
OnGetListenableIndex<T> = int? Function(T)
A function that retrieves an index (or a similar representative integer value) from a listenable object T.
OnRouteChanged<T> = FutureOr<void> Function(T, int)
A callback function that is invoked when the route associated with a listenable T (at a given int index) changes.
PathBuilder = String Function(String current, String path)
A function that constructs a new path string, typically by combining a current path with a relative path segment.
PathMatcher = MatchData? Function(String path, String pattern, {bool prefix})
A function that attempts to match a given path against a specified pattern.
PathMatcherBuilder = PathMatcher Function()
A factory function that creates an instance of a PathMatcher.
PopAction = (WouterState, bool) Function(WouterState, [dynamic])
Defines the signature for a "pop" navigation action.
PopPredicate = bool Function(String path, [dynamic result])
A predicate function used to determine if a "pop" navigation action from a given path (with an optional result) should be allowed or processed.
PushAction = (WouterState, Future<R?>) Function<R>(WouterState, String)
Defines the signature for a "push" navigation action.
PushPredicate = bool Function(String path)
A predicate function used to determine if a "push" navigation action to a given path should be allowed or processed.
RegexpBuilder = RegexpData Function(String pattern, {bool caseSensitive, bool prefix})
A function that builds RegexpData from a route pattern string.
ToIndexCallback = int? Function(String base, String path, List<String> routes)
A callback function to convert a full path string back into an index, given a base path and a list of known routes.
ToPathCallback = String? Function(int index, String base, String path, List<String> routes)
A callback function to convert an index and a base path into a full route path string, considering a list of available routes.
WouterAction = R Function<R>((WouterState, R) (ActionBuilder, WouterState))
Defines a higher-order function type for executing a Wouter navigation action.
WouterActionsCallbacks = ({List<bool Function(String, [dynamic])> pop, List<bool Function(String)> push})
A record type for registering callbacks that can intercept or observe Wouter navigation actions.
WouterEntryBuilder = Widget Function(WidgetBuilder )
A builder function that wraps each individual route's widget before it's added to the list passed to WouterStackBuilder.
WouterListenableWidgetBuilder<T> = Widget Function(BuildContext, T, List<Widget>)
A builder function for creating a widget that responds to changes in a listenable T.
WouterParseRouteInformationCallback = String Function(BuildContext, RouteInformation)
A callback function type used for custom parsing of RouteInformation into a route path string.
WouterRoutes = Map<String, WouterWidgetBuilder>
A type alias for a map defining routes for a WouterNavigator.
WouterStackBuilder = Widget Function(BuildContext, List<Widget>)
A builder function responsible for constructing the UI that displays the stack of active route widgets managed by a WouterNavigator.
WouterWidgetBuilder = Widget Function(BuildContext context, Map<String, dynamic> arguments)
A builder function that creates a widget for a specific route.