convert json array response to list of objects flutter code example
Example: flutter json to list
List to JSON:
_______________________________________________________________________________
List<String> fruits = ['Apple', 'Banana', 'Orange', 'Strawberry'];
String jsonFruits = jsonEncode(fruits);
________________________________________________________________________________
JSON to List:
________________________________________________________________________________
You need to convert each item individually
var json = jsonEncode(jsonFruits.map((e) => e.toJson()).toList());
or pass an toEncodable function
var json = jsonEncode(jsonFruits, toEncodable: (e) => e.toJsonAttr());