resendOtp method

Future<String?> resendOtp({
  1. String nonce = '',
})

Sends the OTP message again via a different provider when the user did not receive the message

Implementation

Future<String?> resendOtp({String nonce = ''}) async {
  String? _nonce = _getOtpRequestNonce() ?? nonce;
  if (_nonce.isEmpty)
    throw ("Couldn't find OTP nonce, please run requestOTP first");
  try {
    String url = '$authEndpoint/user/otp/resend/$_nonce';
    Response res = await dio.post(url);
    _storeOtpRequestNonce(res.data);
    return res.data["nonce"];
  } catch (e) {
    if (e is DioException) throw (e.response.toString());
  }
  return null;
}