mirror of
https://github.com/flutter/samples.git
synced 2026-04-04 02:32:25 +00:00
Cleanup to navigation_and_routing sample (#881)
- make more things private and final, where possible - remove unused members - used expression bodies, where possible
This commit is contained in:
@@ -28,9 +28,7 @@ class SimpleRouterDelegate extends RouterDelegate<ParsedRoute>
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return builder(context);
|
||||
}
|
||||
Widget build(BuildContext context) => builder(context);
|
||||
|
||||
@override
|
||||
Future<void> setNewRoutePath(ParsedRoute configuration) async {
|
||||
@@ -39,9 +37,7 @@ class SimpleRouterDelegate extends RouterDelegate<ParsedRoute>
|
||||
}
|
||||
|
||||
@override
|
||||
ParsedRoute get currentConfiguration {
|
||||
return routeState.route;
|
||||
}
|
||||
ParsedRoute get currentConfiguration => routeState.route;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
||||
@@ -27,13 +27,12 @@ class ParsedRoute {
|
||||
this.path, this.pathTemplate, this.parameters, this.queryParameters);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is ParsedRoute &&
|
||||
other.pathTemplate == pathTemplate &&
|
||||
other.path == path &&
|
||||
_mapEquality.equals(parameters, other.parameters) &&
|
||||
_mapEquality.equals(queryParameters, other.queryParameters);
|
||||
}
|
||||
bool operator ==(Object other) =>
|
||||
other is ParsedRoute &&
|
||||
other.pathTemplate == pathTemplate &&
|
||||
other.path == path &&
|
||||
_mapEquality.equals(parameters, other.parameters) &&
|
||||
_mapEquality.equals(queryParameters, other.queryParameters);
|
||||
|
||||
@override
|
||||
int get hashCode => hash4(
|
||||
|
||||
@@ -44,9 +44,8 @@ class TemplateRouteParser extends RouteInformationParser<ParsedRoute> {
|
||||
|
||||
@override
|
||||
Future<ParsedRoute> parseRouteInformation(
|
||||
RouteInformation routeInformation) async {
|
||||
return await _parse(routeInformation);
|
||||
}
|
||||
RouteInformation routeInformation) async =>
|
||||
await _parse(routeInformation);
|
||||
|
||||
Future<ParsedRoute> _parse(RouteInformation routeInformation) async {
|
||||
final path = routeInformation.location!;
|
||||
@@ -74,7 +73,6 @@ class TemplateRouteParser extends RouteInformationParser<ParsedRoute> {
|
||||
}
|
||||
|
||||
@override
|
||||
RouteInformation restoreRouteInformation(ParsedRoute configuration) {
|
||||
return RouteInformation(location: configuration.path);
|
||||
}
|
||||
RouteInformation restoreRouteInformation(ParsedRoute configuration) =>
|
||||
RouteInformation(location: configuration.path);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,6 @@ class RouteStateScope extends InheritedNotifier<RouteState> {
|
||||
Key? key,
|
||||
}) : super(key: key, notifier: notifier, child: child);
|
||||
|
||||
static RouteState? of(BuildContext context) {
|
||||
return context
|
||||
.dependOnInheritedWidgetOfExactType<RouteStateScope>()
|
||||
?.notifier;
|
||||
}
|
||||
static RouteState? of(BuildContext context) =>
|
||||
context.dependOnInheritedWidgetOfExactType<RouteStateScope>()?.notifier;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user