listenTo method
StreamSubscription<ShopModel?>
listenTo(
- String documentId,
- ShopChanged changed, {
- ShopErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<ShopModel?> listenTo(
String documentId, ShopChanged changed,
{ShopErrorHandler? errorHandler}) {
var stream = shopCollection.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;
}