AsyncNotifier<T> constructor

AsyncNotifier<T>(
  1. T _initial
)

Creates a AsyncNotifier with an initial value.

Implementation

AsyncNotifier(this._initial) {
  final init = _Snapshot(
    CancelableOperation.fromFuture(Future.value(_initial)),
    _initial,
    null,
  );
  _subject = BehaviorSubject<_Snapshot<T>>.seeded(init);
  _subscription = _stream.listen((event) {
    if (!_isDisposed) {
      notifyListeners();
    }
  });
}