listenTo method
StreamSubscription<AppModel?>
listenTo(
- String documentId,
- AppChanged changed, {
- AppErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<AppModel?> listenTo(String documentId, AppChanged changed,
{AppErrorHandler? errorHandler}) {
var stream = appCollection.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;
}