listenTo method

  1. @override
StreamSubscription<ProductDisplayModel?> listenTo(
  1. String documentId,
  2. ProductDisplayChanged changed, {
  3. ProductDisplayErrorHandler? errorHandler,
})
override

Implementation

@override
StreamSubscription<ProductDisplayModel?> listenTo(
    String documentId, ProductDisplayChanged changed,
    {ProductDisplayErrorHandler? errorHandler}) {
  var stream =
      productDisplayCollection.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;
}