title: error in saving two users chat in flutter
body: <p>I was making chat app in flutter with firebase. I was able to save the users chat in firebase by this function:</p>
  <pre><code>await FirebaseFirestore.instance
                          .collection(&quot;Chats&quot;)
                          .doc(uid! + FirebaseAuth.instance.currentUser!.uid)
                          .collection(&quot;messages&quot;)
                          .add({
                        FirebaseAuth.instance.currentUser!.uid:
                            chatController.text,
                        
                      }).then((value) =&gt; () {
                                b = uid;
                              });
  </code></pre>
  <p>but when I save the one users chat. I was thinking that when I will get the chat of second user. It will return a chat from the doc I was saving the both users chat. But unfortunately when I save the users chat it saves a new doc named first users id and then second users id, in first users chat it saves doc named the second user id and first users id. I know what is the reason from which it was happening but how can I resolve that, I mean how can I save the both users chat in one doc</p>
  <p><strong>Update</strong>: the function I have tried based on Frank's answer:</p>
  <pre><code> var docId = uid
          .toString()
          
          .compareTo(FirebaseAuth.instance.currentUser!.uid) &gt; 0;
  </code></pre>
  <p>the function used for printing docId:</p>
  <pre><code>    IconButton(
                icon: Icon(Icons.send),
                iconSize: 20.0,
                onPressed: () async { print(docId);}
              )
  </code></pre>