Rank 3: Container
I tried List but function errors out
"Type '_GrowableList is not a subtype of 'List'
Anyone can share a quick sample of a dart cloud function to read from and write to an string array attribute in a collection.
Votes
0
Replies
8
Participants
Unknown
Messages
9
Rank 3: Container
I tried List but function errors out
"Type '_GrowableList is not a subtype of 'List'
Anyone can share a quick sample of a dart cloud function to read from and write to an string array attribute in a collection.
Admin
you can do value.cast<String>(); but it might be better to be more defensive and check if value were null and default to an empty list.
Rank 3: Container
Sorry but I would need more then that. I currently getDocument and then
List x = received document.data['array_attribute']
So what do I change ?
Apologies for dumbing it down
Like so
List<dynamic> dList = ['First string', 'And another'];
List<String> stringList = dynamiclist.cast<String>();So in your example you can do
List<String> data = document.data['array_attribute'].cast<String>(); @punti_z did you get your question resolved or still needed help? checking to see if we should close or not 🙂
Rank 3: Container
[Closed] What would be Dart data type for a String Array attribute in a database collection ?
Rank 3: Container
Done
[SOLVED] What would be Dart data type for a String Array attribute in a database collection ?