notResumed method

Future<String?> notResumed()

The lifecycle when the app is not resumed, so a read that waits on frames cannot finish; null when it is resumed or unknown.

Implementation

Future<String?> notResumed() async {
  final cached = lastLifecycle;
  final rt = runtime;
  if (cached == null || cached == 'resumed' || rt == null) return null;
  try {
    final live =
        await rt.evaluateString('WidgetsBinding.instance.lifecycleState?.name ?? ""').timeout(lifecycleProbeTimeout);
    if (live == 'resumed') {
      _onLifecycle(live);
      return null;
    }
    return live == null || live.isEmpty ? cached : live;
  } on Object {
    return cached;
  }
}