resendOtp method
Implementation
void resendOtp(BuildContext context) async {
try {
isResendLoading.value = true;
offStageAuthoriseButton.value = true;
var request = {
'email': Storage.getValue(Constants.userEmail),
'api_key': Constants.apiKey,
'sub_client_api_key': Storage.getValue(Constants.subClientApiKey)
};
var response = await DioClient().request(
context: context,
api: '/resend-otp',
method: Method.POST,
params: request);
ResendOtpResponse resendOtpResponse =
ResendOtpResponse.fromJson(response);
if (resendOtpResponse.status == Strings.success) {
Utils.showSnackbar(context, Strings.success, resendOtpResponse.message!,
AppColors.green);
} else {
return Utils.showSnackbar(context, Strings.error,
response['message'].toString().toTitleCase(), AppColors.red);
}
} on DioError catch (e) {
return Utils.showSnackbar(context, Strings.error,
Utils.handleErrorComing(e).toTitleCase(), Colors.red);
} catch (e) {
isLoading(false);
return Utils.showSnackbar(
context, Strings.error, e.toString().toTitleCase(), Colors.red);
} finally {
isResendLoading(false);
offStageAuthoriseButton(false);
}
update();
}