Unverified Commit 42b02d0a authored by Polina Cherkasova's avatar Polina Cherkasova Committed by GitHub

Use const route for notAnnounced. (#144050)

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