added comments and refactored code

This commit is contained in:
2025-01-28 22:36:23 +01:00
parent 6828a9a14b
commit 8f5ed07be9
12 changed files with 83 additions and 58 deletions

View File

@@ -9,6 +9,7 @@ class Api {
static const String _rootUrl =
'https://environment.data.gov.uk/flood-monitoring';
/// Fetches all stationszt
static Future<List<FloodStation>> fetchAllStations() async {
List<FloodStation> stations = [];
final response = await http.get(Uri.parse('$_rootUrl/id/stations'));
@@ -37,7 +38,6 @@ class Api {
/// [limit] limits the number of entries that are requested from the API and [offset] returns the
/// list starting from the specified number
static Future<List<FloodStation>> fetchStationsByRange(
int limit, int offset) async {
List<FloodStation> stations = [];
@@ -52,6 +52,7 @@ class Api {
return stations;
}
/// Fetches all readings from the station with the specified [stationId] from the last 24h
static Future<List<Reading>> fetchReadingsFromStation(
String stationId) async {
List<Reading> readings = [];