foregroundWarning function
Returns a WARNING: ... line when lifecycleState (an
AppLifecycleState.name reported by fdb_helper) means the app is not the
visible foreground app, or null when it is (resumed) or unknown (null,
e.g. an older fdb_helper that does not report lifecycle).
Implementation
String? foregroundWarning(String? lifecycleState) {
switch (lifecycleState) {
case null:
case 'resumed':
return null;
case 'inactive':
return 'WARNING: App is inactive (lifecycle=inactive). A system dialog, '
'Control Center, or the app switcher may be covering it; output may '
'not match what is on screen.';
default:
return 'WARNING: App is not in the foreground (lifecycle=$lifecycleState). '
'Another app or the home screen is covering it; output reflects this '
"app's last frame, not what is on screen. Bring it to the front "
'(e.g. fdb deeplink, or relaunch) before trusting describe/screenshot.';
}
}