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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user