I'm trying to make chat app in flutter using firebase. And i want to know, can i make chat using users id? I mean chatID=user1ID+user2ID, is it possible?
Asked
Active
Viewed 251 times
2
-
It is. You can add a document containing the text messages with the name "user1ID+user2ID". What did you tried yet ? – Maxouille Apr 07 '21 at 12:00
-
i tried to add in Realtime Database in every users profile same IDs and named it 'Chat ID'. I want to save in users profile IDs of every chat he have, but idk how even create chat with 2 IDs – Apr 07 '21 at 12:02
-
I typically model the ID of chat rooms that way. See https://stackoverflow.com/questions/33540479/best-way-to-manage-chat-channels-in-firebase – Frank van Puffelen Apr 07 '21 at 14:45
1 Answers
0
I think you can add a field of type array to your chat document and name it as chat _user and just pass the two users ids to it as like this =>

Osama Abdelaziz
- 132
- 2
- 8