This is the response from request.
var response = [{"id":4731},{"id":4566},{"id":4336},{"id":4333},{"id":4172},{"id":4170},{"id":4168},{"id":4166},{"id":4163},{"id":4161}];
How to extract ids and store in List of int using flutter. I have try this code but not working.
Future<List<int>> fetchTopIds() async{
final response = await client.get('$_baseUrl/posts?fields=id');
final ids = json.decode(response.body);
return ids.cast<int>();
}