We are trying to push two strings to an array field within Firebase, but I am not having much luck.
Here is the code we currently have in place
chatsRef.doc(task.id).set({
'members': {
([assignee.id, task.ownerId])
}
});
And this is the error we seem to be getting:
The following assertion was thrown while handling a gesture:
'dart:ui/hash_codes.dart': Failed assertion: line 17 pos 12: 'o is! Iterable': is not true.
CodePudding user response:
Try this way:
chatsRef.doc(task.id).set({
'members': [assignee.id, task.ownerId]
});
CodePudding user response:
You're trying add a list into a map. A map should have a key. So you can follow @Peter Kotlai like:
chatsRef.doc(task.id).set({
'members': [assignee.id, task.ownerId]
});
or add a key like:
chatsRef.doc(task.id).set({
'members': {
'mykey': [assignee.id, task.ownerId],
}
});