streamData method

Stream<QuerySnapshot<Object?>> streamData({
  1. required String collection,
  2. String? collectionChild,
  3. String? idChild,
  4. bool isErrorDialog = true,
  5. dynamic onError(
    1. String? message
    )?,
})

Implementation

Stream<QuerySnapshot> streamData({
  required String collection,
  String? collectionChild,
  String? idChild,
  bool isErrorDialog = true,
  Function(String? message)? onError,
}) {
  if (collectionChild == null && idChild == null) {
    return _firestore
        .collection(collection)
        // .orderBy("dateCreated", descending: true)
        .snapshots();
  } else {
    return _firestore
        .collection(collection)
        .doc(idChild)
        .collection(collectionChild!)
        // .orderBy("dateCreated", descending: true)
        .snapshots();
  }
}