RegistrationVerifyOTP method

Future RegistrationVerifyOTP({
  1. dynamic mobNum,
  2. dynamic deviceid,
  3. dynamic otp,
  4. dynamic fcmkey,
  5. dynamic email,
})

Implementation

Future RegistrationVerifyOTP({
  mobNum,
  deviceid,
  otp,
  fcmkey,
  email,
}) async {
  final response = await http.post(
    Uri.parse('${SDK_BASE_URL}claim_adminpanel/claim_api/corporate_verify'),
    body: {
      "device_id": deviceid,
      "mobile": mobNum,
      "otp": otp,
      "fcmkey": fcmkey,
      "source": Platform.isAndroid ? 1.toString() : 2.toString(),
      "email_id": email,
      "userid": CorId.toString()
    },
  );
  var decodedResponse = json.decode(response.body);

  if (decodedResponse['status'] == true) {
    Get.back();
    SharedPreferences _prefs = await SharedPreferences.getInstance();
    _prefs.setString('currentUserToken', decodedResponse['access_token']);
    currentUserToken = _prefs.getString('currentUserToken');

    Get.offAll(HomePage());
  } else {
    Get.back();
    Get.snackbar("${decodedResponse['message']}", "",
        backgroundColor: Color(0xffFFFFFF));
  }
}