pushToStream method

  1. @nonVirtual
  2. @mustCallSuper
void pushToStream(
  1. TData data
)

Pushes data into the internal stream and triggers.

Implementation

@nonVirtual
@mustCallSuper
void pushToStream(TData data) {
  if (_streamController == null || _streamController?.isClosed == true) {
    return;
  }
  if (shouldAdd(data)) {
    _streamController!.add(data);
    final completed = _initialDataCompleter?.isCompleted ?? false;
    if (!completed) {
      _initialDataCompleter?.complete(data);
    }
    provideOnPushToStreamListeners().forEach((e) => e(data));
  }
}