otpVerify static method

Future<bool> otpVerify(
  1. dynamic otp,
  2. dynamic token
)

Implementation

static Future<bool> otpVerify(otp, token) async {
  Response response;
  final dio = apiClient();
  try {
    var data = dio.then((value) async {
      response = await value.post(UrlResources.otpVerify, data: {"otp": otp});
      if (response.statusCode == 200) {
        return true;
      } else {
        throw Exception("Invalid OTP");
      }
    });
    return data;
  } catch (e) {
    throw Exception("Something went wrong, try again");
  }
}