streamSubCollection property

Stream<Map<String, Stream<List<T>>>> get streamSubCollection

Stream of sub-collections for each document in the main collection.

Returns a stream that emits a map of sub-collection streams for each document. Useful for complex data structures with nested collections.

Usage

StreamBuilder<Map<String, Stream<List<Post>>>>(
  stream: userCollection.streamSubCollection,
  builder: (context, snapshot) {
    if (snapshot.hasData) {
      final subCollections = snapshot.data!;
      // Handle sub-collections
    }
    return CircularProgressIndicator();
  },
);

Requirements

  • subPath must be specified
  • Each document in the main collection must have a sub-collection

Implementation

Stream<Map<String,Stream<List<T>>>> get streamSubCollection{
  assert(subPath != null);
  return _getCollection.limit(limit).snapshots().map(_subSnapshot);
}