addNewBank method

void addNewBank(
  1. BuildContext context
)

Implementation

void addNewBank(BuildContext context) async {
  try {
    isAddBank(true);
    var request = {
      'token': Storage.getValue(Constants.token),
      'api_key': Constants.apiKey,
      'sub_client_api_key': Storage.getValue(Constants.subClientApiKey)
    };
    var response = await DioClient().request(
        context: context, api: '/me', method: Method.POST, params: request);

    MeResponse meResponse = MeResponse.fromJson(response);
    if (meResponse.status == Strings.success) {
      String url =
          'https://api.deposits.dev/api/v1/show-bank-popup/${Constants.apiKey}/${meResponse.data!.user!.id}';
      // print(url);
      Utils.launchURL(url);
    } else {
      return Utils.showSnackbar(
          context, Strings.error, response['message'], AppColors.red);
    }
  } finally {
    isAddBank(false);
  }
  update();
}