I am making a friend req type Functionality So if I tap on add friend button the name of Current Logged in person should be added to the request list of person named I searched.
So from my app when I click on add friend button, let say current logged in user is 'c@c.com' and I search for 'd@d.com' then 'c@c.com' user name should be added in the requests array of the person 'd@d.com'.
This is my search method to search a user
void onSearch() async {
await _firestore
.collection("users")
.where("email", isEqualTo: _search.text)
.get()
.then((value) {
setState(() {
userMap = value.docs[0].data();
});
});
}
What should I write in addUser method?
void addUser() async {
await _firestore
.collection("users")
.where("email", isEqualTo: _search.text)
.get()
;
}
To learn how to add items to and remove items from an array, see the Firebase documentation on updating an array . To learn how to update all documents that match a query, see How to get the document ref to a where clause firestore?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.