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.
diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart index 0a07055..5d33997 100644 --- a/packages/flutter_tools/lib/src/base/utils.dart +++ b/packages/flutter_tools/lib/src/base/utils.dart
@@ -45,10 +45,8 @@ } 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<int> bytes) {