From e78cbe5df9c1cb8d505aeda97d07f90fe064af18 Mon Sep 17 00:00:00 2001 From: chunhtai <47866232+chunhtai@users.noreply.github.com> Date: Tue, 14 Jul 2020 16:06:01 -0700 Subject: [PATCH] fix code comments in the route route didadd method (#61400) --- packages/flutter/lib/src/widgets/navigator.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/flutter/lib/src/widgets/navigator.dart b/packages/flutter/lib/src/widgets/navigator.dart index 168099677e..41c8d60c75 100644 --- a/packages/flutter/lib/src/widgets/navigator.dart +++ b/packages/flutter/lib/src/widgets/navigator.dart @@ -214,9 +214,16 @@ abstract class Route { // will be guarded by the asynchronous gap. TickerFuture.complete().then((void _) { // The route can be disposed before the ticker future completes. This can - // happen when the navigator is under a TabView that does a warping. The - // navigator will be null in this case, and we have to do a null-safe - // operation. + // happen when the navigator is under a TabView that warps from one tab to + // another, non-adjacent tab, with an animation. The TabView reorders its + // children before and after the warping completes, and that causes its + // children to be built and disposed within the same frame. If one of its + // children contains a navigator, the routes in that navigator are also + // added and disposed within that frame. + // + // Since the reference to the navigator will be set to null after it is + // disposed, we have to do a null-safe operation in case that happens + // within the same frame when it is added. navigator?.focusScopeNode?.requestFocus(); }); }