getWalletUtilizationData method

Future getWalletUtilizationData({
  1. dynamic walletId,
  2. dynamic packageId,
})

Implementation

Future getWalletUtilizationData({
  walletId,
  packageId,
}) async {
  var decodedResponse;

  var url = '${WELLNESS_URL}api/package/wallet-transaction-history';
  try {
    if (packageId != null) {
      url += '?package_id=$packageId';
    }
    if (walletId != null) {
      url += '&wallet_id=$walletId';
    }

    final response = await http.get(
      Uri.parse(url),
      headers: {'Authorization': currentUserToken},
    );

    decodedResponse = json.decode(response.body);

    getWalletUtilizationDetails = decodedResponse['data'];
  } catch (e) {
    ErrorListner(
      apiname: '$url',
      responsed: "${decodedResponse}",
      request: "",
      app_error: '${e}',
    );
  }
}