fetch method
- String type
This function will fetch the data from the JSON API and return a decoded
Implementation
Future<http.Response> fetch(String type) async {
var client = http.Client();
http.Response response;
try {
response = await client.get('https://shuttles.rpi.edu/$type');
// await createJSONFile('$type', response);
if (response.statusCode == 200) {
isConnected = true;
}
} catch (error) {
isConnected = false;
}
//print("App has polled $type API: $isConnected");
return response;
}