listenTo method

  1. @override
StreamSubscription<GridModel?> listenTo(
  1. String documentId,
  2. GridChanged changed, {
  3. GridErrorHandler? errorHandler,
})
override

Implementation

@override
StreamSubscription<GridModel?> listenTo(
    String documentId, GridChanged changed,
    {GridErrorHandler? errorHandler}) {
  var stream = gridCollection.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;
}