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("submit/idChecks/verifyOtp", data: {"otp": otp});
      // response = await dio.post("${baseUrl1}submit/idChecks/verifyOtp", data: {"otp": otp});
     // print("otpVerify response =${response}");

      if (response.statusCode == 200) {
        return true;
      } else {
        throw Exception("Invalid OTP");
      }
    });
    return data;
  } catch (e) {
    //print("e =${e.toString()}");
    throw Exception("Something went wrong, try again");
  }
}