listenTo method

  1. @override
StreamSubscription<PresentationModel?> listenTo(
  1. String documentId,
  2. PresentationChanged changed, {
  3. PresentationErrorHandler? errorHandler,
})
override

Implementation

@override
StreamSubscription<PresentationModel?> listenTo(
    String documentId, PresentationChanged changed,
    {PresentationErrorHandler? errorHandler}) {
  var stream =
      presentationCollection.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;
}