watchCollection method
Opens a real-time stream of documents in collection.
The stream emits the full current list every time any document in the collection changes. Implementations backed by REST APIs (e.g. MongoSyncSource) fall back to periodic polling.
Pass userId to scope the stream to a single user's documents.
Implementation
@override
Stream<List<Map<String, dynamic>>> watchCollection({
required String collection,
String? userId,
}) {
return _collectionRef(
collection,
userId: userId,
).snapshots().map((snap) => snap.docs.map(_docToMap).toList());
}