I’m using the default chat flow in FlutterFlow for my app's chat feature. The setup works well, but I’m facing an issue with duplicate chat creation.
Problem: When a user initiates a chat with another user, a new chat document is created in the database. If the same user tries to start another chat with the same person later, a new chat document is created again instead of navigating to the existing chat.
Question: How can I modify the chat flow to:
Check if a chat already exists between the current user and the selected user.
Navigate to the existing chat if found, or create a new chat if none exists.
Any guidance, code snippets, or documentation references would be greatly appreciated!
Thanks in advance for your help!
@flutterflow team — Great work on the default chat flow! Is there a reason why this logic isn’t included?
The image below shows the action setup from the button to create a new chat.