Fixed bug - Loading Indicator now functions correctly
This commit is contained in:
@@ -21,6 +21,20 @@ class Api {
|
||||
return stations;
|
||||
}
|
||||
|
||||
/// Fetches all stations whose label contain [label]
|
||||
static Future<List<FloodStation>> fetchFilteredStations(String label) async {
|
||||
List<FloodStation> stations = [];
|
||||
final response =
|
||||
await http.get(Uri.parse('$_rootUrl/id/stations?search=$label'));
|
||||
if (response.statusCode == 200) {
|
||||
final Map<String, dynamic> jsonStr = jsonDecode(response.body);
|
||||
for (final str in jsonStr['items']) {
|
||||
stations.add(FloodStation.fromMap(str));
|
||||
}
|
||||
}
|
||||
return stations;
|
||||
}
|
||||
|
||||
/// [limit] limits the number of entries that are requested from the API and [offset] returns the
|
||||
/// list starting from the specified number
|
||||
|
||||
|
||||
Reference in New Issue
Block a user