listenTo method
StreamSubscription<BlockingModel?>
listenTo(
- String documentId,
- BlockingChanged changed, {
- BlockingErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<BlockingModel?> listenTo(
String documentId, BlockingChanged changed,
{BlockingErrorHandler? errorHandler}) {
var stream =
blockingCollection.doc(documentId).snapshots().asyncMap((data) {
return _populateDocPlus(data);
});
var theStream = stream.listen((value) {
changed(value);
});
theStream.onError((theException, theStacktrace) {
if (errorHandler != null) {
errorHandler(theException, theStacktrace);
}
});
return theStream;
}