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);