You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/go_router/README.md
+54-36Lines changed: 54 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,49 @@
1
-
# go_router, A Declarative Routing Package for Flutter
1
+
# go_router
2
2
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.
7
9
8
10
## Getting Started
9
11
10
12
Follow the [package install instructions](https://pub.dev/packages/go_router/install),
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
70
85
depending on the app at the top of its widget tree, e.g. the use of `MaterialApp`
71
86
will cause go_router to use the `MaterialPage` transitions. Consider using
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`:
@@ -108,24 +127,23 @@ To navigate between routes, use the [GoRouter.go](https://pub.dev/documentation/
108
127
onTap: () => GoRouter.of(context).go('/page2')
109
128
```
110
129
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
112
131
methods:
113
132
114
133
```dart
115
134
onTap: () => context.go('/page2')
116
135
```
117
136
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)
121
139
122
140
123
141
## Migration guides
124
142
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)
0 commit comments