listenTo method

  1. @override
StreamSubscription<SimpleTextModel?> listenTo(
  1. String documentId,
  2. SimpleTextChanged changed, {
  3. SimpleTextErrorHandler? errorHandler,
})
override

Implementation

@override
StreamSubscription<SimpleTextModel?> listenTo(
    String documentId, SimpleTextChanged changed,
    {SimpleTextErrorHandler? errorHandler}) {
  var stream =
      simpleTextCollection.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;
}