diff --git a/packages/flutter/test/cupertino/nav_bar_test.dart b/packages/flutter/test/cupertino/nav_bar_test.dart index 44e55e9698..61b5a5ec07 100644 --- a/packages/flutter/test/cupertino/nav_bar_test.dart +++ b/packages/flutter/test/cupertino/nav_bar_test.dart @@ -2089,6 +2089,7 @@ void main() { testWidgets('Large title snaps up to persistent nav bar when partially scrolled over halfway up', (WidgetTester tester) async { final ScrollController scrollController = ScrollController(); + addTearDown(scrollController.dispose); const double largeTitleHeight = 52.0; await tester.pumpWidget( @@ -2130,6 +2131,7 @@ void main() { testWidgets('Large title snaps back to extended height when partially scrolled halfway up or less', (WidgetTester tester) async { final ScrollController scrollController = ScrollController(); + addTearDown(scrollController.dispose); const double largeTitleHeight = 52.0; await tester.pumpWidget( @@ -2170,6 +2172,7 @@ void main() { testWidgets('Large title and bottom snap up when partially scrolled over halfway up in automatic mode', (WidgetTester tester) async { final ScrollController scrollController = ScrollController(); + addTearDown(scrollController.dispose); const double largeTitleHeight = 52.0; const double bottomHeight = 100.0; @@ -2228,6 +2231,7 @@ void main() { testWidgets('Large title and bottom snap down when partially scrolled halfway up or less in automatic mode', (WidgetTester tester) async { final ScrollController scrollController = ScrollController(); + addTearDown(scrollController.dispose); const double largeTitleHeight = 52.0; const double bottomHeight = 100.0; diff --git a/packages/flutter/test/material/menu_anchor_test.dart b/packages/flutter/test/material/menu_anchor_test.dart index 659ade774c..96f66c2933 100644 --- a/packages/flutter/test/material/menu_anchor_test.dart +++ b/packages/flutter/test/material/menu_anchor_test.dart @@ -4667,12 +4667,18 @@ void main() { return results; } + late final OverlayEntry overlayEntry; + addTearDown((){ + overlayEntry.remove(); + overlayEntry.dispose(); + }); + Widget boilerplate() { return MaterialApp( home: Overlay( key: overlayKey, initialEntries: [ - OverlayEntry( + overlayEntry = OverlayEntry( builder: (BuildContext context) { return Scaffold( body: Center( diff --git a/packages/flutter/test/widgets/router_test.dart b/packages/flutter/test/widgets/router_test.dart index f6fa0e22b1..ff6029ec30 100644 --- a/packages/flutter/test/widgets/router_test.dart +++ b/packages/flutter/test/widgets/router_test.dart @@ -41,9 +41,7 @@ void main() { expect(find.text('update'), findsOneWidget); }); - testWidgets('Router respects update order', - experimentalLeakTesting: LeakTesting.settings.withCreationStackTrace(), - (WidgetTester tester) async { + testWidgets('Router respects update order', (WidgetTester tester) async { final SimpleRouteInformationProvider provider = SimpleRouteInformationProvider(); addTearDown(provider.dispose); provider.value = RouteInformation(