Вам нужно создать модель данных, а затем проанализировать JSON:
import 'dart:convert';
class YourDataModel {
final String yourData;
Post({this.yourData});
YourDataModel.fromJson(Map<String, dynamic> json) {
return YourDataModel(
yourData: json['yourData'],
);
}
}
Future<List<String>> fetchData() async {
final response =
await http.get('mobile_app_air_ports');
if (response.statusCode == 200) {
// If server returns an OK response, parse the JSON
return (json.decode(response.body) as List<dynamic>)
.map<YourDataModel>((item) => YourDataModel.fromMap(item))
.toList();
} else {
// If that response was not OK, throw an error.
throw Exception('Failed to load post');
}
}