1

Error is: _TypeError (type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List')

  Future<List<Data>> fetchData() async {
    final response = await http.get(
    Uri.parse('link'),
    headers: headers);
   if (response.statusCode == 200) {
    List jsonResponse = json.decode(response.body);
    return jsonResponse.map((data) => new Data.fromJson(data)).toList();
  } else {
   throw Exception('Unexpected error occured!');
 }
}

my error field is: List jsonResponse = json.decode(response.body);

Ravindra S. Patil
  • 11,757
  • 3
  • 13
  • 40
doğan kısa
  • 43
  • 1
  • 7

0 Answers0