listenTo method

  1. @override
StreamSubscription<DrawerModel?> listenTo(
  1. String documentId,
  2. DrawerChanged changed, {
  3. DrawerErrorHandler? errorHandler,
})
override

Implementation

@override
StreamSubscription<DrawerModel?> listenTo(
    String documentId, DrawerChanged changed,
    {DrawerErrorHandler? errorHandler}) {
  var stream = drawerCollection.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;
}