streamDetail method

Stream<DocumentSnapshot<Object?>> streamDetail({
  1. required String collection,
  2. String? collectionChild,
  3. required String id,
  4. String? idChild,
  5. Map<String, dynamic>? data,
  6. bool isErrorDialog = true,
  7. dynamic onError(
    1. String? message
    )?,
})

Implementation

Stream<DocumentSnapshot> streamDetail({
  required String collection,
  String? collectionChild,
  required String id,
  String? idChild,
  Map<String, dynamic>? data,
  bool isErrorDialog = true,
  Function(String? message)? onError,
}) {
  if (collectionChild == null) {
    return _firestore
        // .doc(uid)
        .collection(collection)
        .doc(id)
        // .orderBy("dateCreated", descending: true)
        .snapshots();
  } else {
    return _firestore
        .collection(collection)
        .doc(id)
        .collection(collectionChild)
        .doc(idChild)
        // .orderBy("dateCreated", descending: true)
        .snapshots();
  }
}