When I add an email address to the map field vote data, Due to "." inside email address, it is creating a sub map with email.
How can I overcome this??
//Code Below
await FirebaseFirestore.instance
.collection('polls')
.doc(pollId)
.update({"voteData.$currentUser": option});
Here currentUser = "[email protected]"
I tried this code too
await FirebaseFirestore.instance
.collection('polls')
.doc(pollId)
.update({"voteData.${currentUser.replaceAll(".", "\\.")}": option});
but output is
CodePudding user response:
You have to escape the .
Try this,
await FirebaseFirestore.instance
.collection('polls')
.doc(pollId)
.update({"voteData.${currentUser.replaceAll(".","\\.")}": option});