updateCurrentWard method
Updates the user's currently selected ward.
This updates the currentWardID
, currentWardName
, floor
, and optionally
currentBlockName
in the user object and persists the updated user data.
wardId
The ID of the new current ward.
wardName
The name of the new current ward.
floor
Optional floor number of the ward.
blockName
Optional block name, if different from the current one.
Implementation
Future<void> updateCurrentWard(
int wardId,
String wardName, {
int? floor,
String? blockName,
}) async {
if (_user != null) {
_user = _user!.copyWith(
currentWardID: wardId,
currentWardName: wardName,
floor: floor,
currentBlockName: blockName ?? _user!.currentBlockName,
);
await _saveUserData(_user!);
notifyListeners();
}
}