SafeRouter class

A type-safe router for Flutter applications.

SafeRouter works together with SafeRoute and SafeNestedRoute to provide strictly typed navigation with arguments and results.

Typical usage:

final router = SafeRouter()
  ..registerAll([homeRoute, settingsRoute]);

MaterialApp(
  onGenerateRoute: router.onGenerateRoute,
);

Constructors

SafeRouter.new()

Properties

defaultPath String
Gets or sets the default path.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

find(String? name) SafeRoute<Object?, Object?>?
Finds a registered route by its name.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onGenerateRoute(RouteSettings settings) Route<Object?>?
A callback for MaterialApp.onGenerateRoute.
registerAll(List<RouteNode<Object?>> routes) → void
Registers multiple routes at once.
toString() String
A string representation of this object.
inherited

Operators

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