From acbfb40f05d28225398f262eb70cd51cf894aa64 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 17 May 2023 10:50:36 -0700 Subject: [PATCH] Handle null return from WillPopCallback (#127039) Partial revert of https://github.com/flutter/flutter/pull/126647 to work around issue in google3. See b/283046390 --- packages/flutter/lib/src/widgets/routes.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart index 7cd4ead6ef..76b8814dbc 100644 --- a/packages/flutter/lib/src/widgets/routes.dart +++ b/packages/flutter/lib/src/widgets/routes.dart @@ -1499,7 +1499,9 @@ abstract class ModalRoute extends TransitionRoute with LocalHistoryRoute? scope = _scopeKey.currentState; assert(scope != null); for (final WillPopCallback callback in List.of(_willPopCallbacks)) { - if (!await callback()) { + // TODO(goderbauer): Tests using the Component Framework in google3 insist on returning + // null for mocked out WillPopCallbacks. Fix that to remove ignore. + if (await callback() != true) { // ignore: no_literal_bool_comparisons return RoutePopDisposition.doNotPop; } }