redeemReward method

Future<void> redeemReward(
  1. TransactionItem transactionItem
)

Implementation

Future<void> redeemReward(TransactionItem transactionItem) async {
  var headers = {'Authorization': token};

  var request = http.Request('PUT', Uri.parse('$baseUrl/wallet/uw/redeemed'));
  request.body = json.encode(
      {"walletId": walletId, "walletReward": transactionItem.toJson()});
  request.headers.addAll(headers);

  http.StreamedResponse response = await request.send();

  if (response.statusCode == 200) {
    if (kDebugMode) (await response.stream.bytesToString());
  } else {
    throw Exception('Failed to redeem reward');
  }
}