1

I have a database in firebase with a structure like this:

Collection("Users").Document("user.uid").Collection("chats")

Im using a texfield --> onSubmit to create new data when I press enter key,

child: TextField(
decoration: InputDecoration(
 border: InputBorder.none,
hintText: 'Type your message...',
hintStyle: TextStyle(
 color: Colors.grey[500]),
),
 controller: queryController,
textInputAction:
  TextInputAction.send,
 onSubmitted: (msg) {},
}

I want to compare the entries of the TextField ( using a controller for example) with this key:

Firebase information that I want to comare

Something like:

If (Controller== Databasekey) {
print("dont do it");
}

Does any way to do it?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 1
    Check this [Link](https://stackoverflow.com/questions/51122211/check-if-field-already-exists-in-flutter-firestore) – Sal Man Jun 12 '21 at 02:31

0 Answers0