loadSingleDocData method

Future<Map<String, dynamic>?> loadSingleDocData(
  1. String collectin,
  2. String id
)

Loads single document data from the specified collection and id and returns it as a Future<Map<String, dynamic>>.

collectin - The name of the collection. id - The id of the document.

Implementation

Future<Map<String, dynamic>?> loadSingleDocData(
    String collectin, String id) async {
  CollectionReference firebaseCollection;
  firebaseCollection = FirebaseFirestore.instance.collection(collectin);
  DocumentSnapshot doc = await firebaseCollection.doc(id).get();

  return doc.data() as Map<String, dynamic>;
}