I’m trying to register data in an array for my API in node, but the data only arrives “wrong”, in the case of ingredients
console:
{
title: 'One more try',
ingredients: [ '["Ingredient A","Ingredient B", "sweet"]' ],
instructions: 'I don't know.',
imageUrl: [],
difficulty: 'Medium ',
time: '36',
servings: 5,
_id: new ObjectId('667f225ccc58dfb1e42a20cf'),
createdAt: 2024-06-28T20:51:40.117Z
}
In the App (Flutter) the model ingredients are List
On controller var ingredients = [].obs;
In the view
TextField(
onChanged: (value) {
controller.ingredients.value = value.split(',');
},
decoration: const InputDecoration(
labelText: 'Ingredients (comma separated)'),
),)
If I remove the value split it shows the message: A value of type 'String' can't be assigned to a variable of type 'List<String>'
.