addLifecycleAware method

bool addLifecycleAware(
  1. StreamSubscription? streamSubscription, {
  2. Set<LifecycleState> lifecycleStates = LifecycleStateUtils.ALL_STATES,
  3. RecreateOnResume? recreateOnResume,
})

The streamSubscription to be aware of life cycle changes The lifecycleStates to take into account during changes, by default all lifeCycles will be taken into account The recreateOnResume function indicates that the streamSubscription should cancel on pause and recreate on resume by using this function

Implementation

bool addLifecycleAware(StreamSubscription? streamSubscription,
        {Set<LifecycleState> lifecycleStates = LifecycleStateUtils.ALL_STATES,
        RecreateOnResume? recreateOnResume}) =>
    streamSubscription != null
        ? _streamSubscriptionsLifecycleAware
            .add(StreamSubscriptionLifecycleAware(
            streamSubscription: streamSubscription,
            lifecycleStates: lifecycleStates,
            recreateOnResume: recreateOnResume,
          ))
        : false;