Simple query on a specific document ID and return a Bool in a Custom Function

Custom Code

Hi there, I'm stuck, I tryed almost anything to make this work, only thin I want to do is query for a document exists in a collection;

final FirebaseFirestore db = FirebaseFirestore.instance; db.collection('users_chat').doc(documentid).get().then((doc) { print(doc.data()); print(documentid); print(doc.exists); return doc.exists; });

sorry for the prints, but they work and give me the right results, but a) Test Function gives an error about Error: 'FirebaseFirestore' isn't a type. final FirebaseFirestore db = FirebaseFirestore.instance; and if I want to use the result as a bool for conditional button it never goes to True if the default is False

Why I want to query is xxxx_xxxxx document ID exists in a collection, to switch a button from Invite to chat to Go to Chat

What have you tried so far?

multiple versions

test function

print outputs

Did you check FlutterFlow's Documentation for this topic?
Yes
1
3 replies