listenTo method
StreamSubscription<PostLikeModel?>
listenTo(
- String documentId,
- PostLikeChanged changed, {
- PostLikeErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<PostLikeModel?> listenTo(
String documentId, PostLikeChanged changed,
{PostLikeErrorHandler? errorHandler}) {
var stream =
postLikeCollection.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;
}