diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index 4e94bfa0ef5..b22d0f2b08b 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -138,7 +138,7 @@ enum RoutePopDisposition { /// The type argument `T` is the route's return type, as used by /// [currentResult], [popped], and [didPop]. The type `void` may be used if the /// route does not return a value. -abstract class Route { +abstract class Route extends _RoutePlaceholder { /// Initialize the [Route]. /// /// If the [settings] are not provided, an empty [RouteSettings] object is @@ -2896,10 +2896,9 @@ enum _RouteLifecycle { typedef _RouteEntryPredicate = bool Function(_RouteEntry entry); -class _NotAnnounced extends Route { - // A placeholder for the lastAnnouncedPreviousRoute, the - // lastAnnouncedPoppedNextRoute, and the lastAnnouncedNextRoute before any - // change has been announced. +/// Placeholder for a route. +class _RoutePlaceholder { + const _RoutePlaceholder(); } class _RouteEntry extends RouteTransitionRecord { @@ -2937,12 +2936,12 @@ class _RouteEntry extends RouteTransitionRecord { /// remove as a result of a page update. static const int kDebugPopAttemptLimit = 100; - static final Route notAnnounced = _NotAnnounced(); + static const _RoutePlaceholder notAnnounced = _RoutePlaceholder(); _RouteLifecycle currentState; - Route? lastAnnouncedPreviousRoute = notAnnounced; // last argument to Route.didChangePrevious - WeakReference> lastAnnouncedPoppedNextRoute = WeakReference>(notAnnounced); // last argument to Route.didPopNext - Route? lastAnnouncedNextRoute = notAnnounced; // last argument to Route.didChangeNext + _RoutePlaceholder? lastAnnouncedPreviousRoute = notAnnounced; // last argument to Route.didChangePrevious + WeakReference<_RoutePlaceholder> lastAnnouncedPoppedNextRoute = WeakReference<_RoutePlaceholder>(notAnnounced); // last argument to Route.didPopNext + _RoutePlaceholder? lastAnnouncedNextRoute = notAnnounced; // last argument to Route.didChangeNext int? lastFocusNode; // The last focused semantic node for the route entry. /// Restoration ID to be used for the encapsulating route when restoration is diff --git a/packages/flutter/test/painting/system_fonts_test.dart b/packages/flutter/test/painting/system_fonts_test.dart index a0b45374cc7..3176dbced2a 100644 --- a/packages/flutter/test/painting/system_fonts_test.dart +++ b/packages/flutter/test/painting/system_fonts_test.dart @@ -40,10 +40,7 @@ void main() { // TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean] LeakTesting.settings = LeakTesting.settings.withIgnored(classes: ['CurvedAnimation']); - testWidgets('RenderParagraph relayout upon system fonts changes', - // TODO(polina-c): dispose _NotAnnounced, https://github.com/dart-lang/leak_tracker/issues/218 [leaks-to-clean] - experimentalLeakTesting: LeakTesting.settings.withIgnored(classes: ['ValueNotifier', '_NotAnnounced']), - (WidgetTester tester) async { + testWidgets('RenderParagraph relayout upon system fonts changes', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: Text('text widget'),