Need to check if a field value exists inside a Firestore document? Here’s the code for it!

Share This Post

I had a use case where I wanted to validate a code entered against a field inside a Firestore collection document. My goal was to get a true/false response. It’s easy to check if the document exists, but I struggled when trying to find if the value exists inside a specific field…

Enter Custom Actions…

Here’s the custom action code I used, then I just run the custom action with the textinput provided and get a boolean response.

					Future<bool> checkIfCodeExists (String CODETOCHECK) async {

  QuerySnapshot querySnapshot = await FirebaseFirestore.instance
      .where('CODE FIELD NAME', isEqualTo: CODETOCHECK)


More To Explore

Reorderable / Order List Widget for FlutterFlow

Introducing MyReorderableList: The Universal Reordering Widget for Firebase Collections in FlutterFlow! MyReorderableList is a versatile custom widget tailored to FlutterFlow users working with Firebase. This

Let's Talk

You can also email me at