listenTo method
StreamSubscription<ProfileModel?>
listenTo(
- String documentId,
- ProfileChanged changed, {
- ProfileErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<ProfileModel?> listenTo(
String documentId, ProfileChanged changed,
{ProfileErrorHandler? errorHandler}) {
var stream = profileCollection.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;
}