unsure if this nuke was needed but it cleaner now
This commit is contained in:
@@ -8,10 +8,12 @@ Future<List<Arrival>> fetchArrivals() async {
|
||||
final response = await http.get(Uri.parse('http://141.144.238.26:48502/arrivals/all'));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
List<dynamic> data = jsonDecode(response.body);
|
||||
List<Arrival> arrivals = List<Arrival>.from(data.map((dynamic arrivalJson) {
|
||||
return Arrival.fromJson(arrivalJson);
|
||||
}));
|
||||
// List<dynamic> data = jsonDecode(response.body);
|
||||
// List<Arrival> arrivals = List<Arrival>.from(data.map((dynamic arrivalJson) {
|
||||
// return Arrival.fromJson(arrivalJson);
|
||||
// }));
|
||||
Iterable I = json.decode(response.body);
|
||||
List<Arrival> arrivals = List<Arrival>.from(I.map((model)=>Arrival.fromJson(model)));
|
||||
return arrivals;
|
||||
} else {
|
||||
throw Exception('Failed to load Arrival');
|
||||
|
||||
Reference in New Issue
Block a user