updateCurrentBlock method
Updates the user's currently selected block.
This updates the currentBlockId
and currentBlockName
in the user object
and persists the updated user data.
blockId
The ID of the new current block.
blockName
The name of the new current block.
Implementation
Future<bool> updateCurrentBlock(int blockId, String blockName) async {
try {
if (_user != null) {
_user = _user!.copyWith(
currentBlockId: blockId,
currentBlockName: blockName,
);
await _saveUserData(_user!);
notifyListeners();
}
return true;
} catch (e) {
_setError(parseApiError(e.toString()));
return false;
}
}