activate method
Implementation
Future<void> activate(String code, String trolleyNo) async {
if (code.isEmpty) {
state = state.copyWith(error: 'Please enter the activation code');
return;
}
state = state.copyWith(isLoading: true, error: null);
final result = await _repo.activateDevice(code, trolleyNo);
switch (result) {
case NetworkSuccess():
state = state.copyWith(isLoading: false, isSuccess: true);
case NetworkError():
state = state.copyWith(isLoading: false, error: result.message);
}
}