makeLiveCancellable method

Cancellable makeLiveCancellable({
  1. Cancellable? other,
})

构建一个绑定到lifecycle的Cancellable

Implementation

Cancellable makeLiveCancellable({Cancellable? other}) {
  assert(currentLifecycleState > LifecycleState.destroyed,
      'Must be used before destroyed.');
  if (currentLifecycleState <= LifecycleState.destroyed) {
    return Cancellable()..cancel();
  }
  return _map
      .putIfAbsent(this, () => _CacheMapObserver(this))
      ._makeCancellableForLive(other: other);
}