add benzin to gasview
This commit is contained in:
@@ -7,11 +7,25 @@ class EControlService {
|
||||
double longitude,
|
||||
String fuelType,
|
||||
) async {
|
||||
// REST Service... URL
|
||||
String apiUrl =
|
||||
'https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude=$latitude&longitude=$longitude&fuelType=$fuelType&includeClosed=false';
|
||||
var response = await http.get(Uri.parse(apiUrl));
|
||||
print('${response.statusCode}');
|
||||
return jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
return jsonDecode(response.body);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/// Holt parallel Diesel ('DIE') und Super ('SUP') Daten
|
||||
Future<Map<String, List<dynamic>>> getBothFuelData(
|
||||
double latitude,
|
||||
double longitude,
|
||||
) async {
|
||||
final results = await Future.wait([
|
||||
getEControlData(latitude, longitude, 'DIE'),
|
||||
getEControlData(latitude, longitude, 'SUP'),
|
||||
]);
|
||||
|
||||
return {'DIE': results[0], 'SUP': results[1]};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user