FluroRouter class

Attach FluroRouter to MaterialApp by connnecting FluroRouter.generator to MaterialApp.onGenerateRoute.

Define routes with FluroRouter.define, optionally specifying transition types and connecting string path params to your screen widget's constructor.

Push new route paths with FluroRouter.appRouter.navigateTo or continue to use Navigator.of(context).push if you prefer.

Constructors

FluroRouter()

Properties

hashCode int
The hash code for this object.
no setterinherited
notFoundHandler Handler?
Generic handler for when a route has not been defined
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

define(String routePath, {required Handler? handler, TransitionType? transitionType, Duration transitionDuration = defaultTransitionDuration, RouteTransitionsBuilder? transitionBuilder, bool? opaque}) → void
Creates a PageRoute definition for the passed RouteHandler. You can optionally provide a default transition type.
generator(RouteSettings routeSettings) Route?
Route generation method. This function can be used as a way to create routes on-the-fly if any defined handler is found. It can also be used with the MaterialApp.onGenerateRoute property as callback to create routes that can be used with the Navigator class.
match(String path) AppRouteMatch?
Finds a defined AppRoute for the path value. If no AppRoute definition was found then function will return null.
matchRoute(BuildContext? buildContext, String? path, {RouteSettings? routeSettings, TransitionType? transitionType, Duration? transitionDuration, RouteTransitionsBuilder? transitionsBuilder, bool maintainState = true, bool? opaque}) RouteMatch
Attempt to match a route to the provided path.
Similar to Navigator.push but with a few extra features.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pop<T>(BuildContext context, [T? result]) → void
Similar to Navigator.pop
printTree() → void
Prints the route tree so you can analyze it.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

appRouter FluroRouter
The static / singleton instance of FluroRouter
final

Constants

defaultTransitionDuration → const Duration
The default transition duration to use throughout Fluro