listenTo method
StreamSubscription<ProductModel?>
listenTo(
- String documentId,
- ProductChanged changed, {
- ProductErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<ProductModel?> listenTo(
String documentId, ProductChanged changed,
{ProductErrorHandler? errorHandler}) {
var stream = productCollection.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;
}