listen method
Listens to the given stream and sets the reference's value to whatever is emitted on the stream.
Returns a Future that completes when the stream is done, analogous to
StreamController.addStream
.
Implementation
Future listen(Stream<T> stream) {
_listenSub?.cancel();
_listenSub = stream.listen((v) {
value = v;
});
return _listenSub!.asFuture();
}