Skip to content

Commit 13e6cb1

Browse files
Merge tag 'go_router-v4.2.7' into go-router/allow-list-of-query-parameters
# Conflicts: # packages/go_router/CHANGELOG.md # packages/go_router/pubspec.yaml
2 parents a13a58d + 4e17094 commit 13e6cb1

File tree

4 files changed

+65
-39
lines changed

4 files changed

+65
-39
lines changed

.ci/flutter_master.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
708d2121cbcfa92008cd7e47657fdcf170382941
1+
183d3e410102f4347eedce60950379d86991323a

packages/go_router/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
## 4.2.6
1+
## 4.2.8
22

33
- Allows `Map<String, dynamic>` maps as `queryParams` of `goNamed`, `replacedName`, `pushNamed` and `namedLocation`.
44

5+
## 4.2.7
6+
7+
- Update README
8+
9+
## 4.2.6
10+
11+
- Fixes rendering issues in the README.
12+
513
## 4.2.5
614

715
- Fixes a bug where calling extra parameter is always null in route level redirect callback

packages/go_router/README.md

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,49 @@
1-
# go_router, A Declarative Routing Package for Flutter
1+
# go_router
22

3-
This package builds on top of the Flutter framework's Router API and provides
4-
convenient url-based APIs to navigate between different screens. You can
5-
define your own url patterns, navigating to different url, handle deep and
6-
dynamic linking, and a number of other navigation-related scenarios.
3+
A Declarative Routing Package for Flutter.
4+
5+
This package uses the Flutter framework's Router API to provide a
6+
convenient, url-based API for navigating between different screens. You can
7+
define URL patterns, navigate using a URL, handle deep links,
8+
and a number of other navigation-related scenarios.
79

810
## Getting Started
911

1012
Follow the [package install instructions](https://pub.dev/packages/go_router/install),
11-
and you can start using go_router in your code:
13+
and you can start using go_router in your app:
1214

1315
```dart
16+
import 'package:flutter/material.dart';
17+
import 'package:go_router/go_router.dart';
18+
19+
void main() => runApp(App());
20+
1421
class App extends StatelessWidget {
1522
App({Key? key}) : super(key: key);
1623
1724
@override
18-
Widget build(BuildContext context) => MaterialApp.router(
19-
routeInformationProvider: _router.routeInformationProvider,
20-
routeInformationParser: _router.routeInformationParser,
21-
routerDelegate: _router.routerDelegate,
22-
title: 'GoRouter Example',
23-
);
25+
Widget build(BuildContext context) {
26+
return MaterialApp.router(
27+
routeInformationProvider: _router.routeInformationProvider,
28+
routeInformationParser: _router.routeInformationParser,
29+
routerDelegate: _router.routerDelegate,
30+
title: 'GoRouter Example',
31+
);
32+
}
2433
2534
final GoRouter _router = GoRouter(
2635
routes: <GoRoute>[
2736
GoRoute(
2837
path: '/',
29-
builder: (BuildContext context, GoRouterState state) => const Page1Screen(),
38+
builder: (BuildContext context, GoRouterState state) {
39+
return ScreenA();
40+
},
3041
),
3142
GoRoute(
32-
path: '/page2',
33-
builder: (BuildContext context, GoRouterState state) => const Page2Screen(),
43+
path: '/b',
44+
builder: (BuildContext context, GoRouterState state) {
45+
return ScreenB();
46+
},
3447
),
3548
],
3649
);
@@ -39,7 +52,7 @@ class App extends StatelessWidget {
3952

4053
## Define Routes
4154

42-
go_router is governed by a set of routes which are specify as part of the
55+
go_router is governed by a set of routes which are specified as part of the
4356
[GoRouter](https://pub.dev/documentation/go_router/latest/go_router/GoRouter-class.html)
4457
constructor:
4558

@@ -58,27 +71,33 @@ GoRouter(
5871
);
5972
```
6073

61-
It defined two routes, `/` and `/page2`. Each route path will be matched against
62-
the location to which the user is navigating. The path will be matched in a
63-
case-insensitive way, although the case for parameters will be preserved. If
64-
there are multiple route matches, the <b>first</b> match in the list takes priority
65-
over the others.
66-
67-
In addition to the path, each route will typically have a [builder](https://pub.dev/documentation/go_router/latest/go_router/GoRoute/builder.html)
68-
function that is responsible for building the `Widget` that is to take up the
69-
entire screen of the app. The default transition is used between pages
74+
In the above snippet, two routes are defined, `/` and `/page2`.
75+
When the URL changes, it is matched against each route path.
76+
The path is matched in a case-insensitive way, but the case for
77+
parameters is preserved. If there are multiple route matches,
78+
the **first match** in the list takes priority over the others.
79+
80+
The [builder](https://pub.dev/documentation/go_router/latest/go_router/GoRoute/builder.html)
81+
is responsible for building the `Widget` to display on screen.
82+
Alternatively, you can use `pageBuilder` to customize the transition
83+
animation when that route becomes active.
84+
The default transition is used between pages
7085
depending on the app at the top of its widget tree, e.g. the use of `MaterialApp`
7186
will cause go_router to use the `MaterialPage` transitions. Consider using
7287
[pageBuilder](https://pub.dev/documentation/go_router/latest/go_router/GoRoute/pageBuilder.html)
7388
for custom `Page` class.
7489

7590
## Initalization
7691

77-
Once a [GoRouter](https://pub.dev/documentation/go_router/latest/go_router/GoRouter-class.html)
78-
object is created, it can be used to initialize `MaterialApp` or `CupertinoApp`.
92+
Create a [GoRouter](https://pub.dev/documentation/go_router/latest/go_router/GoRouter-class.html)
93+
object and initialize your `MaterialApp` or `CupertinoApp`:
7994

8095
```dart
81-
final GoRouter _router = GoRouter(..);
96+
final GoRouter _router = GoRouter(
97+
routes: <GoRoute>[
98+
// ...
99+
]
100+
);
82101
83102
MaterialApp.router(
84103
routeInformationProvider: _router.routeInformationProvider,
@@ -108,24 +127,23 @@ To navigate between routes, use the [GoRouter.go](https://pub.dev/documentation/
108127
onTap: () => GoRouter.of(context).go('/page2')
109128
```
110129

111-
go_router also provides a simplified means of navigation using Dart extension
130+
go_router also provides a more concise way to navigate using Dart extension
112131
methods:
113132

114133
```dart
115134
onTap: () => context.go('/page2')
116135
```
117136

118-
<br>
119-
120-
### Still not sure how to proceed? See [examples](https://github.com/flutter/packages/tree/main/packages/go_router/example) for complete runnable examples or visit [API documentation](https://pub.dev/documentation/go_router/latest/go_router/go_router-library.html)
137+
### Still not sure how to proceed?
138+
See [examples](https://github.com/flutter/packages/tree/main/packages/go_router/example) for complete runnable examples or visit [API documentation](https://pub.dev/documentation/go_router/latest/go_router/go_router-library.html)
121139

122140

123141
## Migration guides
124142

125-
[Migrating to 2.0](https://flutter.dev/go/go-router-v2-breaking-changes)<br/>
126-
[Migrating to 2.5](https://flutter.dev/go/go-router-v2-5-breaking-changes)<br/>
127-
[Migrating to 3.0](https://flutter.dev/go/go-router-v3-breaking-changes)<br/>
128-
[Migrating to 4.0](https://flutter.dev/go/go-router-v4-breaking-changes)<br/>
143+
- [Migrating to 2.0](https://flutter.dev/go/go-router-v2-breaking-changes)
144+
- [Migrating to 2.5](https://flutter.dev/go/go-router-v2-5-breaking-changes)
145+
- [Migrating to 3.0](https://flutter.dev/go/go-router-v3-breaking-changes)
146+
- [Migrating to 4.0](https://flutter.dev/go/go-router-v4-breaking-changes)
129147

130148
## Changelog
131149

packages/go_router/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: go_router
22
description: A declarative router for Flutter based on Navigation 2 supporting
33
deep linking, data-driven routes and more
4-
version: 4.2.6
4+
version: 4.2.8
55
repository: https://github.com/flutter/packages/tree/main/packages/go_router
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22
77

0 commit comments

Comments
 (0)