@@ -41,6 +41,9 @@ dart run build_runner build
41
41
Read more about using
42
42
[`build_runner` on pub.dev](https://pub.dev/packages/build_runner).
43
43
44
+ # # Migration Guides
45
+ - [Migrating to 4.0.0](https://flutter.dev/go/go-router-builder-v4-breaking-changes).
46
+
44
47
# # Overview
45
48
46
49
` go_router` fundamentally relies on the ability to match a string-based location
@@ -86,7 +89,7 @@ method.
86
89
87
90
<? code-excerpt "example/lib/readme_excerpts.dart (HomeRoute)"?>
88
91
``` dart
89
- class HomeRoute extends GoRouteData with _ $HomeRoute {
92
+ class HomeRoute extends GoRouteData with $HomeRoute {
90
93
const HomeRoute();
91
94
92
95
@override
@@ -106,7 +109,7 @@ The tree of routes is defined as an attribute on each of the top-level routes:
106
109
TypedGoRoute<FamilyRoute>(path: 'family/:fid'),
107
110
],
108
111
)
109
- class HomeRoute extends GoRouteData with _ $HomeRoute {
112
+ class HomeRoute extends GoRouteData with $HomeRoute {
110
113
const HomeRoute();
111
114
112
115
@override
@@ -122,7 +125,7 @@ class RedirectRoute extends GoRouteData {
122
125
}
123
126
124
127
@TypedGoRoute<LoginRoute>(path: '/login')
125
- class LoginRoute extends GoRouteData with _ $LoginRoute {
128
+ class LoginRoute extends GoRouteData with $LoginRoute {
126
129
LoginRoute({this.from});
127
130
final String? from;
128
131
@@ -210,7 +213,7 @@ Parameters (named or positional) not listed in the path of `TypedGoRoute` indica
210
213
<? code-excerpt "example/lib/readme_excerpts.dart (login)"?>
211
214
``` dart
212
215
@TypedGoRoute<LoginRoute>(path: '/login')
213
- class LoginRoute extends GoRouteData with _ $LoginRoute {
216
+ class LoginRoute extends GoRouteData with $LoginRoute {
214
217
LoginRoute({this.from});
215
218
final String? from;
216
219
@@ -228,7 +231,7 @@ For query parameters with a **non-nullable** type, you can define a default valu
228
231
<? code-excerpt "example/lib/readme_excerpts.dart (MyRoute)"?>
229
232
``` dart
230
233
@TypedGoRoute<MyRoute>(path: '/my-route')
231
- class MyRoute extends GoRouteData with _ $MyRoute {
234
+ class MyRoute extends GoRouteData with $MyRoute {
232
235
MyRoute({this.queryParameter = 'defaultValue'});
233
236
final String queryParameter;
234
237
@@ -249,7 +252,7 @@ parameter with the special name `$extra`:
249
252
250
253
<? code-excerpt "example/lib/readme_excerpts.dart (PersonRouteWithExtra)"?>
251
254
``` dart
252
- class PersonRouteWithExtra extends GoRouteData with _ $PersonRouteWithExtra {
255
+ class PersonRouteWithExtra extends GoRouteData with $PersonRouteWithExtra {
253
256
PersonRouteWithExtra(this.$extra);
254
257
final Person? $extra;
255
258
@@ -281,7 +284,7 @@ You can, of course, combine the use of path, query and $extra parameters:
281
284
``` dart
282
285
@TypedGoRoute<HotdogRouteWithEverything>(path: '/:ketchup')
283
286
class HotdogRouteWithEverything extends GoRouteData
284
- with _ $HotdogRouteWithEverything {
287
+ with $HotdogRouteWithEverything {
285
288
HotdogRouteWithEverything(this.ketchup, this.mustard, this.$extra);
286
289
final bool ketchup; // A required path parameter.
287
290
final String? mustard; // An optional query parameter.
@@ -341,7 +344,7 @@ The code generator can convert simple types like `int`, `enum`, and `extension t
341
344
enum BookKind { all, popular, recent }
342
345
343
346
@TypedGoRoute<BooksRoute>(path: '/books')
344
- class BooksRoute extends GoRouteData with _ $BooksRoute {
347
+ class BooksRoute extends GoRouteData with $BooksRoute {
345
348
BooksRoute({this.kind = BookKind.popular});
346
349
final BookKind kind;
347
350
@@ -370,7 +373,7 @@ method of the base class instead of the `build` method:
370
373
371
374
<? code-excerpt "example/lib/readme_excerpts.dart (MyMaterialRouteWithKey)"?>
372
375
``` dart
373
- class MyMaterialRouteWithKey extends GoRouteData with _ $MyMaterialRouteWithKey {
376
+ class MyMaterialRouteWithKey extends GoRouteData with $MyMaterialRouteWithKey {
374
377
const MyMaterialRouteWithKey();
375
378
static const LocalKey _key = ValueKey<String>('my-route-with-key');
376
379
@override
@@ -386,7 +389,7 @@ Overriding the `buildPage` method is also useful for custom transitions:
386
389
387
390
<? code-excerpt "example/lib/readme_excerpts.dart (FancyRoute)"?>
388
391
``` dart
389
- class FancyRoute extends GoRouteData with _ $FancyRoute {
392
+ class FancyRoute extends GoRouteData with $FancyRoute {
390
393
const FancyRoute();
391
394
@override
392
395
CustomTransitionPage<void> buildPage(
@@ -442,7 +445,7 @@ class MyShellRouteData extends ShellRouteData {
442
445
}
443
446
444
447
// For GoRoutes:
445
- class MyGoRouteData extends GoRouteData with _ $MyGoRouteData {
448
+ class MyGoRouteData extends GoRouteData with $MyGoRouteData {
446
449
const MyGoRouteData();
447
450
448
451
static final GlobalKey<NavigatorState> $parentNavigatorKey = rootNavigatorKey;
@@ -463,7 +466,7 @@ Define a relative route by extending `RelativeGoRouteData`.
463
466
<? code-excerpt "example/lib/readme_excerpts.dart (relativeRoute)"?>
464
467
``` dart
465
468
@TypedRelativeGoRoute<DetailsRoute>(path: 'details')
466
- class DetailsRoute extends RelativeGoRouteData with _ $DetailsRoute {
469
+ class DetailsRoute extends RelativeGoRouteData with $DetailsRoute {
467
470
const DetailsRoute();
468
471
469
472
@override
0 commit comments