listenTo method
StreamSubscription<PostModel?>
listenTo(
- String documentId,
- PostChanged changed, {
- PostErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<PostModel?> listenTo(
String documentId, PostChanged changed,
{PostErrorHandler? errorHandler}) {
var stream = postCollection.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;
}