setRefferalCode method

Future<bool> setRefferalCode(
  1. String code
)

Implementation

Future<bool> setRefferalCode(String code) async {
  Map<String, dynamic> data = {"code": code};
  print(data);
  var response =
      await Requests.getDio().post("subscriber/referral/set", data: data);
  print('Response Set Refferal ====  $response');
  if (response.statusCode == 200) {
    return true;
  } else {
    print(response.data);
    CustomFlashWidget.showFlashMessage(
      type: FlashType.error,
      title: "Error",
      message: response.data["message"] ??
          response.data?["errorCode"] ??
          response.data?["message"]?["errorCode"] ??
          "Something unexpected happened. Please try again later!",
    );
    return false;
  }
}