classifyLifecycleQueryError function

LifecycleQueryResult classifyLifecycleQueryError(
  1. Object error, {
  2. required bool appAlive,
})

Classifies a failure of the lifecycle query. Only a timeout (or an explicit VmNotRespondingException) with the app still alive counts as "not responding"; everything else is LifecycleUnavailable.

Implementation

LifecycleQueryResult classifyLifecycleQueryError(Object error, {required bool appAlive}) {
  final timedOut = error is TimeoutException || error is VmNotRespondingException;
  return timedOut && appAlive ? const LifecycleVmNotResponding() : const LifecycleUnavailable();
}