simple view of town names

This commit is contained in:
2025-01-24 17:58:36 +01:00
parent 86496005e0
commit bedd9c7d88
3 changed files with 45 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ class Api {
static const String _rootUrl =
'https://environment.data.gov.uk/flood-monitoring';
static Future<void> fetchStations() async {
static Future<List<FloodStation>> fetchStations() async {
List<FloodStation> stations = [];
final response = await http.get(Uri.parse('$_rootUrl/id/stations'));
if (response.statusCode == 200) {
@@ -16,5 +16,6 @@ class Api {
stations.add(FloodStation.fromMap(str));
}
}
return stations;
}
}