From f1f46ef2d380dba878637a29c8627fcd7dfa5277 Mon Sep 17 00:00:00 2001 From: Victoria Ashworth <15619084+vashworth@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:13:21 -0500 Subject: [PATCH] Revert "PlatformRouteInformationProvider should dispatch creation in constructor." (#133479) Reverts flutter/flutter#133353 Tree is failing on Mac and Linux customer_testing on this PR. https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20customer_testing/14646/overview https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20customer_testing/14974/overview --- packages/flutter/lib/src/widgets/router.dart | 6 +----- packages/flutter/test/material/app_test.dart | 1 - packages/flutter/test/widgets/router_test.dart | 15 --------------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/flutter/lib/src/widgets/router.dart b/packages/flutter/lib/src/widgets/router.dart index f0ea086100..63db13e365 100644 --- a/packages/flutter/lib/src/widgets/router.dart +++ b/packages/flutter/lib/src/widgets/router.dart @@ -1465,11 +1465,7 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid /// provider. PlatformRouteInformationProvider({ required RouteInformation initialRouteInformation, - }) : _value = initialRouteInformation { - if (kFlutterMemoryAllocationsEnabled) { - maybeDispatchObjectCreation(); - } - } + }) : _value = initialRouteInformation; static bool _equals(Uri a, Uri b) { return a.path == b.path diff --git a/packages/flutter/test/material/app_test.dart b/packages/flutter/test/material/app_test.dart index 88aafa258a..87e8564da5 100644 --- a/packages/flutter/test/material/app_test.dart +++ b/packages/flutter/test/material/app_test.dart @@ -1161,7 +1161,6 @@ void main() { routerDelegate: delegate, )); expect(tester.takeException(), isAssertionError); - provider.dispose(); }); testWidgetsWithLeakTracking('MaterialApp.router throw if route configuration is provided along with other delegate', (WidgetTester tester) async { diff --git a/packages/flutter/test/widgets/router_test.dart b/packages/flutter/test/widgets/router_test.dart index f4286d4586..a552d67b6c 100644 --- a/packages/flutter/test/widgets/router_test.dart +++ b/packages/flutter/test/widgets/router_test.dart @@ -1582,21 +1582,6 @@ testWidgets('ChildBackButtonDispatcher take priority recursively', (WidgetTester expect(info2.location, '/abc?def=ghi&def=jkl#mno'); }); }); - - test('$PlatformRouteInformationProvider dispatches object creation in constructor', () { - int eventCount = 0; - void listener(ObjectEvent event) => eventCount++; - MemoryAllocations.instance.addListener(listener); - - final PlatformRouteInformationProvider registry = PlatformRouteInformationProvider( - initialRouteInformation: RouteInformation(uri: Uri.parse('http://google.com')), - ); - - expect(eventCount, 1); - - registry.dispose(); - MemoryAllocations.instance.removeListener(listener); - }); } Widget buildBoilerPlate(Widget child) {