@@ -25,19 +25,41 @@ abstract class _GoRouteData extends RouteData {
25
25
const _GoRouteData ();
26
26
27
27
/// Creates the [Widget] for `this` route.
28
+ ///
29
+ /// Subclasses must override one of [build] , [buildPage] , or
30
+ /// [redirect] .
31
+ ///
32
+ /// Corresponds to [GoRoute.builder] .
28
33
Widget build (BuildContext context, GoRouterState state) =>
29
34
throw UnimplementedError (
30
35
'One of `build` or `buildPage` must be implemented.' ,
31
36
);
32
37
33
38
/// A page builder for this route.
39
+ ///
40
+ /// Subclasses can override this function to provide a custom [Page] .
41
+ ///
42
+ /// Subclasses must override one of [build] , [buildPage] or
43
+ /// [redirect] .
44
+ ///
45
+ /// Corresponds to [GoRoute.pageBuilder] .
46
+ ///
47
+ /// By default, returns a [Page] instance that is ignored, causing a default
48
+ /// [Page] implementation to be used with the results of [build] .
34
49
Page <void > buildPage (BuildContext context, GoRouterState state) =>
35
50
const NoOpPage ();
36
51
37
52
/// An optional redirect function for this route.
53
+ ///
54
+ /// Subclasses must override one of [build] , [buildPage] , or
55
+ /// [redirect] .
56
+ ///
57
+ /// Corresponds to [GoRoute.redirect] .
38
58
FutureOr <String ?> redirect (BuildContext context, GoRouterState state) => null ;
39
59
40
60
/// Called when this route is removed from GoRouter's route history.
61
+ ///
62
+ /// Corresponds to [GoRoute.onExit] .
41
63
FutureOr <bool > onExit (BuildContext context, GoRouterState state) => true ;
42
64
43
65
/// The error thrown when a user-facing method is not implemented by the
@@ -118,48 +140,6 @@ abstract class GoRouteData extends _GoRouteData {
118
140
/// [GoRouteData] is abstract and cannot be instantiated directly.
119
141
const GoRouteData ();
120
142
121
- /// Creates the [Widget] for `this` route.
122
- ///
123
- /// Subclasses must override one of [build] , [buildPage] , or
124
- /// [redirect] .
125
- ///
126
- /// Corresponds to [GoRoute.builder] .
127
- @override
128
- Widget build (BuildContext context, GoRouterState state) =>
129
- super .build (context, state);
130
-
131
- /// A page builder for this route.
132
- ///
133
- /// Subclasses can override this function to provide a custom [Page] .
134
- ///
135
- /// Subclasses must override one of [build] , [buildPage] or
136
- /// [redirect] .
137
- ///
138
- /// Corresponds to [GoRoute.pageBuilder] .
139
- ///
140
- /// By default, returns a [Page] instance that is ignored, causing a default
141
- /// [Page] implementation to be used with the results of [build] .
142
- @override
143
- Page <void > buildPage (BuildContext context, GoRouterState state) =>
144
- super .buildPage (context, state);
145
-
146
- /// An optional redirect function for this route.
147
- ///
148
- /// Subclasses must override one of [build] , [buildPage] , or
149
- /// [redirect] .
150
- ///
151
- /// Corresponds to [GoRoute.redirect] .
152
- @override
153
- FutureOr <String ?> redirect (BuildContext context, GoRouterState state) =>
154
- super .redirect (context, state);
155
-
156
- /// Called when this route is removed from GoRouter's route history.
157
- ///
158
- /// Corresponds to [GoRoute.onExit] .
159
- @override
160
- FutureOr <bool > onExit (BuildContext context, GoRouterState state) =>
161
- super .onExit (context, state);
162
-
163
143
/// A helper function used by generated code.
164
144
///
165
145
/// Should not be used directly.
@@ -231,48 +211,6 @@ abstract class RelativeGoRouteData extends _GoRouteData {
231
211
/// [RelativeGoRouteData] is abstract and cannot be instantiated directly.
232
212
const RelativeGoRouteData ();
233
213
234
- /// Creates the [Widget] for `this` route.
235
- ///
236
- /// Subclasses must override one of [build] , [buildPage] , or
237
- /// [redirect] .
238
- ///
239
- /// Corresponds to [GoRoute.builder] .
240
- @override
241
- Widget build (BuildContext context, GoRouterState state) =>
242
- super .build (context, state);
243
-
244
- /// A page builder for this route.
245
- ///
246
- /// Subclasses can override this function to provide a custom [Page] .
247
- ///
248
- /// Subclasses must override one of [build] , [buildPage] or
249
- /// [redirect] .
250
- ///
251
- /// Corresponds to [GoRoute.pageBuilder] .
252
- ///
253
- /// By default, returns a [Page] instance that is ignored, causing a default
254
- /// [Page] implementation to be used with the results of [build] .
255
- @override
256
- Page <void > buildPage (BuildContext context, GoRouterState state) =>
257
- super .buildPage (context, state);
258
-
259
- /// An optional redirect function for this route.
260
- ///
261
- /// Subclasses must override one of [build] , [buildPage] , or
262
- /// [redirect] .
263
- ///
264
- /// Corresponds to [GoRoute.redirect] .
265
- @override
266
- FutureOr <String ?> redirect (BuildContext context, GoRouterState state) =>
267
- super .redirect (context, state);
268
-
269
- /// Called when this route is removed from GoRouter's route history.
270
- ///
271
- /// Corresponds to [GoRoute.onExit] .
272
- @override
273
- FutureOr <bool > onExit (BuildContext context, GoRouterState state) =>
274
- super .onExit (context, state);
275
-
276
214
/// A helper function used by generated code.
277
215
///
278
216
/// Should not be used directly.
0 commit comments