switchBlock method
- int newBlockId
Switches the current block for the authenticated user.
newBlockId
The ID of the block to switch to.
Returns a Future<bool>
which is true
if the switch was successful, false
otherwise.
Implementation
Future<bool> switchBlock(int newBlockId) async {
try {
await _makeRequest(
'/api/switch-block/',
method: 'POST',
body: {
'block_id': newBlockId,
},
);
return true;
} catch (e) {
return false;
}
}