handleStream method
- @preferInline
- @internal
inherited
Listens to a Stream and convert it into an AsyncValue.
Implementation
@preferInline
@internal
void handleStream(
Stream<T> Function() create, {
required bool didChangeDependency,
}) {
_handleAsync(didChangeDependency: didChangeDependency, ({
required data,
required done,
required error,
required last,
}) {
final rawStream = create();
final stream = rawStream.isBroadcast
? rawStream
: rawStream.asBroadcastStream(onCancel: (sub) => sub.cancel());
stream.lastCancelable(last, orElseError: _missingLastValueError);
final sub = stream.listen(data, onError: error, onDone: done);
return sub.cancel;
});
}