Unverified Commit 37ffb2d7 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

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.
parent 1bdbfe7b
...@@ -45,10 +45,8 @@ class BotDetector { ...@@ -45,10 +45,8 @@ class BotDetector {
} }
bool get isRunningOnBot { bool get isRunningOnBot {
if (context == null) { final BotDetector botDetector = context?.getVariable(BotDetector) ?? _kBotDetector;
return _kBotDetector.isRunningOnBot; return botDetector.isRunningOnBot;
}
return context[BotDetector].isRunningOnBot;
} }
String hex(List<int> bytes) { String hex(List<int> bytes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment