Location overview screen and model changes #3
@@ -26,6 +26,16 @@ class LocationController extends ChangeNotifier {
|
||||
return _repository.deleteLocation(location);
|
||||
}
|
||||
|
||||
Future<void> updateLocation(Location oldLocation, Location newLocation) {
|
||||
final index = _locations.indexOf(oldLocation);
|
||||
_locations.remove(oldLocation);
|
||||
_locations.insert(index, newLocation);
|
||||
notifyListeners();
|
||||
return _repository
|
||||
.deleteLocation(oldLocation)
|
||||
.whenComplete(() => _repository.createLocation(newLocation));
|
||||
}
|
||||
|
||||
Future<void> _loadLocations() {
|
||||
_locations.clear();
|
||||
return _repository.loadLocations().then(
|
||||
|
||||
Reference in New Issue
Block a user