From 37ffb2d7304c277185939b74e1a11f76d4ab721e Mon Sep 17 00:00:00 2001 From: Todd Volkert Date: Wed, 21 Feb 2018 15:01:46 -0800 Subject: [PATCH] Make the `isRunningOnBot` getter more robust. (#14811) It was failing in the case of an AppContext being in scope but not having a `BotDetector` seeded in it. --- packages/flutter_tools/lib/src/base/utils.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart index 0a07055525..5d3399764c 100644 --- a/packages/flutter_tools/lib/src/base/utils.dart +++ b/packages/flutter_tools/lib/src/base/utils.dart @@ -45,10 +45,8 @@ class BotDetector { } bool get isRunningOnBot { - if (context == null) { - return _kBotDetector.isRunningOnBot; - } - return context[BotDetector].isRunningOnBot; + final BotDetector botDetector = context?.getVariable(BotDetector) ?? _kBotDetector; + return botDetector.isRunningOnBot; } String hex(List bytes) {