getWalletBalance method

dynamic getWalletBalance()

Implementation

getWalletBalance() {
  String requestTime = "";
  String responseTime = "";
  try {
    currentWalletBalance.value = 0.0;
    currentWalletCurrency.value = "\$";
    Helper.progressDialog(Get.context!, "");
    ApiClient(
      baseUrl: ApiConstant.baseUrl,
      onFetchRequestTime: (time) {
        requestTime = time;
      },
      onFetchResponseTime: (time) {
        responseTime = time;
      },
      screenName: "wallet",
    ).getWalletBalance(
      body: {
        "partnerId": SingletonSotrage.secureStorageInterface.readSecureData(
          SecureStorageService.partnerIdLogin,
        )
      },
    ).then((value) {
      Helper.logEvent(
        "RESPONSE_EVENT",
        success: true,
        endPoint: Api.fetchWalletBalance,
        responseDate: DateTime.now().toString(),
        screenName: "wallet",
        requestDate: requestTime,
      );
      Helper.close();
      currentWalletBalance.value = value.response?.balance ?? 0.0;
      currentWalletCurrency.value = value.response?.currency ?? "\$";
    });
  } catch (e) {
    if (e is DioException) {
      UDID.setTraceId(
        e.response?.headers.map[Constants.traceIdKey]?[0] ?? "",
      );
      Helper.logEvent(
        "ERROR_EVENT",
        failure: true,
        requestDate: requestTime,
        endPoint: Api.fetchWalletBalance,
        responseDate: DateTime.now().toString(),
        screenName: "qrGenerate",
        error: e,
      );
    }
    Helper.close();
    ConditionalLogs().customLog("error $e");
  }
}