routemaster
1.1.1, released 6 months ago by tom.gilder.dev
Easy-to-use URL-based router for Flutter web, mobile and desktop.
What it does
Wraps over Flutter's Router API to provide simple declarative mapping from URLs to pages. Supports nested navigation for tabs, route guards, redirects, and multiple route maps.
AI-written summary of version 1.1.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a declarative, URL-based router for mobile, web, and desktop
- You want easy support for tab-based nested navigation
- You need to handle route guards or swap entire routing maps based on auth state
Skip it when
- You prefer a strictly imperative navigation approach using Navigator.push directly without URL mapping
Strengths
- Simple declarative API with path and query parameters support
- Built-in tab and nested route handling
- Extensive unit, widget, and integration test coverage
Weaknesses
- Requires learning a specific path-based routing structure
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Configure MaterialApp.router with RoutemasterDelegate and RoutemasterParser.
final routes = RouteMap(
routes: {
'/': (_) => MaterialPage(child: HomePage()),
'/feed': (_) => MaterialPage(child: FeedPage()),
}
);
void main() {
runApp(
MaterialApp.router(
routerDelegate: RoutemasterDelegate(routesBuilder: (context) => routes),
routeInformationParser: RoutemasterParser(),
),
);
}Alternatives
Packages that do the same job and could replace routemaster.
- go_router
It is the officially supported declarative routing package by the Flutter team.
98Compare - auto_route
If you prefer code-generation for strongly-typed route arguments and auto-generated navigation code.
87Compare
Works with
Packages commonly used together with routemaster: ones it builds on, ones built on it, and its own family.