WtRouter class

Matches route names to WtRoutes and generates their pages.

Constructors

WtRouter({required List<WtRoute> routes, String initialRoute = '/', Widget notFoundPage(BuildContext, RouteSettings)?})
Creates a router over routes with an initialRoute.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
initialRoute → String
Route shown first when the app starts.
final
notFoundPage → Widget Function(BuildContext, RouteSettings)?
Optional custom page for unmatched routes (defaults to a built-in 404).
final
routes → List<WtRoute>
The registered routes, matched in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispatch(RouteSettings settings) → Route?
onGenerateRoute handler: resolves settings to a page or the 404.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

getParams(String pattern, String path) → Map<String, String>
Extracts :param values from path using the route pattern.