listenTo method
StreamSubscription<ChatModel?>
listenTo(
- String documentId,
- ChatChanged changed, {
- ChatErrorHandler? errorHandler,
override
Implementation
@override
StreamSubscription<ChatModel?> listenTo(
String documentId, ChatChanged changed,
{ChatErrorHandler? errorHandler}) {
var stream = chatCollection.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;
}