fetch function

dynamic fetch(
  1. dynamic table, [
  2. dynamic cond
])

Implementation

fetch(table, [cond]) async {
  Query<Map<String, dynamic>> tempString =
      FirebaseFirestore.instance.collection(table);
  if (cond == null) {
    tempString = FirebaseFirestore.instance.collection(table);
  } else {
    tempString = FirebaseFirestore.instance.collection(table);
    cond.forEach((key, value) {
      tempString = tempString.where(key, isEqualTo: value);
    });
  }
  var tempData = await tempString.get();
  return tempData.docs;
}