listenAndPump method
Returns a StreamSubscription similar to listen, but with the
added benefit that it primes the stream with the current value, rather
than waiting for the next value. This should not be called in onInit
or anywhere else during the build process.
Implementation
StreamSubscription<T> listenAndPump(void Function(T event) onData,
{Function? onError, void Function()? onDone, bool? cancelOnError}) {
final subscription = listen(
onData,
onError: onError,
onDone: onDone,
cancelOnError: cancelOnError,
);
subject.add(value);
return subscription;
}