compareSnapshotData method

Future<void> compareSnapshotData(
  1. String collectionName,
  2. String value,
  3. String fieldName,
  4. dynamic successfulFunction,
  5. dynamic failedFunction,
)

compareSnapshotData...

Implementation

Future<void> compareSnapshotData(String collectionName, String value,
    String fieldName, var successfulFunction, var failedFunction) async {
  QuerySnapshot snapshot = await FirebaseFirestore.instance
      .collection(collectionName)
      .where(fieldName, isEqualTo: value)
      .get()
      .then((value) => successfulFunction())
      .onError((error, stackTrace) => failedFunction())
      .timeout(const Duration(seconds: 30));
}