Skip to content

Commit 37ffb2d

Browse files
authored
Make the isRunningOnBot getter more robust. (flutter#14811)
It was failing in the case of an AppContext being in scope but not having a `BotDetector` seeded in it.
1 parent 1bdbfe7 commit 37ffb2d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/flutter_tools/lib/src/base/utils.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ class BotDetector {
4545
}
4646

4747
bool get isRunningOnBot {
48-
if (context == null) {
49-
return _kBotDetector.isRunningOnBot;
50-
}
51-
return context[BotDetector].isRunningOnBot;
48+
final BotDetector botDetector = context?.getVariable(BotDetector) ?? _kBotDetector;
49+
return botDetector.isRunningOnBot;
5250
}
5351

5452
String hex(List<int> bytes) {

0 commit comments

Comments
 (0)