CorporateHealthcareVerifyOTP method

Future CorporateHealthcareVerifyOTP({
  1. dynamic context,
  2. dynamic otp,
  3. dynamic email,
  4. dynamic mobile,
  5. dynamic emailverify,
  6. dynamic fcmkey,
  7. dynamic deviceid,
})

Implementation

Future CorporateHealthcareVerifyOTP(
    {context, otp, email, mobile, emailverify, fcmkey, deviceid}) async {
  final response = await http.post(
    Uri.parse(
        '${SDK_BASE_URL}claim_adminpanel/claim_api/package_registration/otp_verify'),
    body: {
      "txt_opt": '${otp}',
      "email": '${email}',
      "txt_opt_sent_no": '${mobile}',
      "email_verified": '${emailverify}',
      "fcmkey": '${fcmkey}',
      "source": Platform.isAndroid ? 1.toString() : 2.toString(),
      "device_id": '${deviceid}'
    },
  );
  var decodedResponse = json.decode(response.body);
  if (decodedResponse['status'] == true) {
    SharedPreferences _prefs = await SharedPreferences.getInstance();
    _prefs.setString('currentUserToken', decodedResponse['access_token']);
    currentUserToken = _prefs.getString('currentUserToken');

    Get.offAll(HomePage());
  } else {
    Fluttertoast.showToast(
        msg: "${decodedResponse['message']}",
        fontSize: 11.sp,
        gravity: ToastGravity.CENTER,
        toastLength: Toast.LENGTH_SHORT);
  }
}