Unverified Commit a6765938 authored by chunhtai's avatar chunhtai Committed by GitHub

relax routerReportsNewRouteInformation function signature (#97154)

parent a88888e4
......@@ -1326,7 +1326,7 @@ abstract class RouteInformationProvider extends ValueListenable<RouteInformation
/// For more information on how [Router] determines a navigation event, see
/// the "URL updates for web applications" section in the [Router]
/// documentation.
void routerReportsNewRouteInformation(RouteInformation routeInformation, {required RouteInformationReportingType type}) {}
void routerReportsNewRouteInformation(RouteInformation routeInformation, {RouteInformationReportingType type = RouteInformationReportingType.none}) {}
}
/// The route information provider that propagates the platform route information changes.
......@@ -1349,7 +1349,7 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid
}) : _value = initialRouteInformation;
@override
void routerReportsNewRouteInformation(RouteInformation routeInformation, {required RouteInformationReportingType type}) {
void routerReportsNewRouteInformation(RouteInformation routeInformation, {RouteInformationReportingType type = RouteInformationReportingType.none}) {
final bool replace =
type == RouteInformationReportingType.neglect ||
(type == RouteInformationReportingType.none &&
......
......@@ -802,14 +802,14 @@ testWidgets('ChildBackButtonDispatcher take priority recursively', (WidgetTester
);
log.clear();
provider.routerReportsNewRouteInformation(const RouteInformation(location: 'a', state: true), type: RouteInformationReportingType.none);
provider.routerReportsNewRouteInformation(const RouteInformation(location: 'a', state: true));
// Implicit reporting pushes new history entry if the location changes.
expect(log, <Object>[
isMethodCall('selectMultiEntryHistory', arguments: null),
isMethodCall('routeInformationUpdated', arguments: <String, dynamic>{ 'location': 'a', 'state': true, 'replace': false }),
]);
log.clear();
provider.routerReportsNewRouteInformation(const RouteInformation(location: 'a', state: false), type: RouteInformationReportingType.none);
provider.routerReportsNewRouteInformation(const RouteInformation(location: 'a', state: false));
// Since the location is the same, the provider sends replaces message.
expect(log, <Object>[
isMethodCall('selectMultiEntryHistory', arguments: null),
......@@ -1392,7 +1392,7 @@ class SimpleRouteInformationProvider extends RouteInformationProvider with Chang
}
@override
void routerReportsNewRouteInformation(RouteInformation routeInformation, {required RouteInformationReportingType type}) {
void routerReportsNewRouteInformation(RouteInformation routeInformation, {RouteInformationReportingType type = RouteInformationReportingType.none}) {
_value = routeInformation;
onRouterReport?.call(routeInformation, type);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment