recordExist method

Future<bool> recordExist(
  1. String email
)

Check if user exists with email @param email The email address to check for user existence. @return A Future that resolves to a boolean indicating whether a user with the given email exists. @throws String if there is an error fetching the record.

Implementation

Future<bool> recordExist(String email) async {
  try {
    final snapshot = await _db.collection("users").where(
        "email", isEqualTo: email).get();
    return snapshot.docs.isEmpty ? false : true;
  } catch (e) {
    throw "Error fetching record.";
  }
}