getCollectionStream<Model extends BaseModel> method

  1. @override
Stream<List<Model>> getCollectionStream<Model extends BaseModel>(
  1. String path, {
  2. List<QueryType>? where,
  3. Map<String, bool>? orderby,
  4. int? limit,
})
override

Implementation

@override
Stream<List<Model>> getCollectionStream<Model extends BaseModel>(
  String path, {
  List<QueryType>? where,
  Map<String, bool>? orderby,
  int? limit,
}) {
  var pathParam = path.split("/");
  if (pathParam.length.isEven) {
    throw GetCollectionGroupError(
        "number of ids must be less than paths for subcollection",
        StackTrace.current);
  }

  Query query = collectionPath(pathParam);
  if (where != null) {
    where = checkQueryConstructor(where);
  }

  var collection = queryConstruction(
    query,
    where: where,
    orderby: orderby,
    limit: limit,
  );
  Stream<QuerySnapshot> snapshots = collection.snapshots();
  return snapshots.map((snapshot) => parser.parse<Model>(snapshot));
}