Go Router
flutter
v14.6.2 1.8k stars
3.2M/month
Updated 2024-12-01
A declarative routing package for Flutter that uses the Router API to provide a convenient, url-based API for navigating between different screens.
routing navigation deep-link url
Installation
flutter pub add go_router Key Features
URL-based routing
Deep linking support
Type-safe parameters
Nested navigation
Redirect support
Shell routes for tabs
Usage Example
import 'package:go_router/go_router.dart';
final router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (context, state) => HomeScreen(),
routes: [
GoRoute(
path: 'details/:id',
builder: (context, state) {
final id = state.pathParameters['id']!;
return DetailsScreen(id: id);
},
),
],
),
],
);
// Navigate programmatically
context.go('/details/123');
context.push('/details/456');