23 lines
492 B
Dart
23 lines
492 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../model/flood_station.dart';
|
|
import 'api.dart';
|
|
|
|
class FloodStationProvider extends ChangeNotifier {
|
|
List<FloodStation> _allStations = [];
|
|
FloodStation? selectedStation;
|
|
|
|
List<FloodStation> get allStations => _allStations;
|
|
|
|
Future loadAllStations({silent = false}) {
|
|
return Api.fetchStations().then(
|
|
(value) {
|
|
_allStations = value;
|
|
if (!silent) {
|
|
notifyListeners();
|
|
}
|
|
},
|
|
);
|
|
}
|
|
}
|