listenTo method

  1. @override
StreamSubscription<PayModel?> listenTo(
  1. String documentId,
  2. PayChanged changed, {
  3. PayErrorHandler? errorHandler,
})
override

Implementation

@override
StreamSubscription<PayModel?> listenTo(String documentId, PayChanged changed,
    {PayErrorHandler? errorHandler}) {
  var stream = payCollection.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;
}