patchbayLifecycleReaderFor function

PatchbayLifecycleStateReader patchbayLifecycleReaderFor({
  1. required bool isAppResumed()?,
  2. required PatchbayLifecycleStateReader? lifecycleState,
})

Pairs a lifecycle reader with the resumed decision it has to describe.

lifecycleState wins when the caller supplies one. Otherwise the reader follows isAppResumed: the binding when the default decision is in use, and unknown when the caller replaced it.

Implementation

PatchbayLifecycleStateReader patchbayLifecycleReaderFor({
  required bool Function()? isAppResumed,
  required PatchbayLifecycleStateReader? lifecycleState,
}) =>
    lifecycleState ??
    (isAppResumed == null
        ? patchbayBindingLifecycleState
        : patchbayUnknownLifecycleState);