Skip to content

Commit 3711f6f

Browse files
committed
Remove unnecessary overrides
1 parent 6f539b7 commit 3711f6f

File tree

1 file changed

+22
-84
lines changed

1 file changed

+22
-84
lines changed

packages/go_router/lib/src/route_data.dart

Lines changed: 22 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,41 @@ abstract class _GoRouteData extends RouteData {
2525
const _GoRouteData();
2626

2727
/// Creates the [Widget] for `this` route.
28+
///
29+
/// Subclasses must override one of [build], [buildPage], or
30+
/// [redirect].
31+
///
32+
/// Corresponds to [GoRoute.builder].
2833
Widget build(BuildContext context, GoRouterState state) =>
2934
throw UnimplementedError(
3035
'One of `build` or `buildPage` must be implemented.',
3136
);
3237

3338
/// 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].
3449
Page<void> buildPage(BuildContext context, GoRouterState state) =>
3550
const NoOpPage();
3651

3752
/// 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].
3858
FutureOr<String?> redirect(BuildContext context, GoRouterState state) => null;
3959

4060
/// Called when this route is removed from GoRouter's route history.
61+
///
62+
/// Corresponds to [GoRoute.onExit].
4163
FutureOr<bool> onExit(BuildContext context, GoRouterState state) => true;
4264

4365
/// The error thrown when a user-facing method is not implemented by the
@@ -118,48 +140,6 @@ abstract class GoRouteData extends _GoRouteData {
118140
/// [GoRouteData] is abstract and cannot be instantiated directly.
119141
const GoRouteData();
120142

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-
163143
/// A helper function used by generated code.
164144
///
165145
/// Should not be used directly.
@@ -231,48 +211,6 @@ abstract class RelativeGoRouteData extends _GoRouteData {
231211
/// [RelativeGoRouteData] is abstract and cannot be instantiated directly.
232212
const RelativeGoRouteData();
233213

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-
276214
/// A helper function used by generated code.
277215
///
278216
/// Should not be used directly.

0 commit comments

Comments
 (0)