react method
Subscribes to this stream in a non-memoized manner.
onData
or onError
is called if this stream has triggered the current set of recomputations.
If no onError is provided and the stream has produced an error, the current computation
will be assumed to have thrown that error at the end if it returns a value.
Unlike use, react does trigger a re-computation if the stream consecutively produces values comparing equal to each other.
As a rule of thumb, you should use react over use if this stream
represents a sequence of events rather than a state.
Can only be used inside computations.
Cannot be used inside react callbacks.
onError
has the same semantics as in Stream.listen.
Implementation
void react(void Function(T) onData, [Function? onError]) =>
StreamComputedExtensionImpl<T>(this).react(onData, onError);