Push objects into array in Dart
I will suggest to use
returnMovies.addAll({your object here})
When you do this json.decode(response.body)
you are getting a List
of Map
you should use List<dynamic> movieListData
and get the items like this:
movieListData = json.decode(response.body);
returnMovies = movieListData.map((dynamic movieData) {
String id = movieData['_id'];
String host_group_name = movieData['host_group_name'];
String duration = movieData['duration'];
return new Movie(id,title, duration);
}).toList();
Sounds like you are looking for addAll
returnMovies.addAll(json.decode(returnUpcoming.body))