Fix navigator 2.0 in Flutter Web (#72207)
This commit is contained in:
parent
4e3b01152e
commit
3335bcbe40
@ -666,7 +666,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
|
|||||||
await observer.didPushRouteInformation(
|
await observer.didPushRouteInformation(
|
||||||
RouteInformation(
|
RouteInformation(
|
||||||
location: routeArguments['location'] as String,
|
location: routeArguments['location'] as String,
|
||||||
state: routeArguments['state'] as Object,
|
state: routeArguments['state'] as Object?,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -129,6 +129,23 @@ void main() {
|
|||||||
WidgetsBinding.instance!.removeObserver(observer);
|
WidgetsBinding.instance!.removeObserver(observer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
testWidgets('didPushRouteInformation callback with null state', (WidgetTester tester) async {
|
||||||
|
final PushRouteInformationObserver observer = PushRouteInformationObserver();
|
||||||
|
WidgetsBinding.instance!.addObserver(observer);
|
||||||
|
|
||||||
|
const Map<String, dynamic> testRouteInformation = <String, dynamic>{
|
||||||
|
'location': 'testRouteName',
|
||||||
|
'state': null,
|
||||||
|
};
|
||||||
|
final ByteData message = const JSONMethodCodec().encodeMethodCall(
|
||||||
|
const MethodCall('pushRouteInformation', testRouteInformation));
|
||||||
|
await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/navigation', message, (_) { });
|
||||||
|
expect(observer.pushedRouteInformation.location, 'testRouteName');
|
||||||
|
expect(observer.pushedRouteInformation.state, null);
|
||||||
|
WidgetsBinding.instance!.removeObserver(observer);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('Application lifecycle affects frame scheduling', (WidgetTester tester) async {
|
testWidgets('Application lifecycle affects frame scheduling', (WidgetTester tester) async {
|
||||||
final BinaryMessenger defaultBinaryMessenger = ServicesBinding.instance!.defaultBinaryMessenger;
|
final BinaryMessenger defaultBinaryMessenger = ServicesBinding.instance!.defaultBinaryMessenger;
|
||||||
ByteData message;
|
ByteData message;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user