mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
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.
This commit is contained in:
parent
1bdbfe7b52
commit
37ffb2d730
|
@ -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<int> bytes) {
|
||||
|
|
Loading…
Reference in a new issue