getUpdates method
Getter method to retrieve the list of updated shuttles
Implementation
Future<List<ShuttleUpdate>> getUpdates() async {
/// Returns a list of shuttle updates.
///
/// Fetch 'updates' data from JSON API and store in variable 'response'
/// If unable to retreive data, response is set equal to null.
/// Create list to store data.
/// Decode the data and insert values into the list.
///
///
/// return updatesList;
var response = await fetch('updates');
List<ShuttleUpdate> updatesList = response != null
? json
.decode(response.body)
.map<ShuttleUpdate>((json) => ShuttleUpdate.fromJson(json))
.toList()
: [];
return updatesList;
}