From 06ac2fc5d785c4ed57b228000cebfaefee12c6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Tue, 25 Oct 2022 21:01:00 +0800 Subject: Lose the pointer on structs --- midtrans.dart | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'midtrans.dart') diff --git a/midtrans.dart b/midtrans.dart index b1bc830..a5e622f 100644 --- a/midtrans.dart +++ b/midtrans.dart @@ -37,31 +37,26 @@ class Midtrans { calloc.free(caInfoUtf8); } - void chargeBanktransfer(Pointer payment, - Pointer transaction, + void chargeBanktransfer(MidtransBanktransfer payment, + MidtransTransaction transaction, Array> customFields) { final midtrans_charge = dylib.lookupFunction - , - Pointer, + >), - void Function(Pointer, - Pointer, + void Function(MidtransBanktransfer, MidtransTransaction, Array>)> ('midtrans_charge_banktransfer'); midtrans_charge(payment, transaction, customFields); - calloc.free((payment as MidtransBanktransfer).bank); - if ((payment as MidtransBanktransfer).va_number - != null) { - calloc.free((payment as MidtransBanktransfer) - .va_number); + calloc.free(payment.bank); + if (payment.va_number != null) { + calloc.free(payment.va_number); } - if ((payment as MidtransBanktransfer).bca != null) { - calloc.free((payment as MidtransBanktransfer) - .bca); + if (payment.bca != null) { + calloc.free(payment.bca); } - if ((payment as MidtransBanktransfer).permata != null) { - calloc.free((payment as MidtransBanktransfer) - .permata); + if (payment.permata != null) { + calloc.free(payment.permata); } calloc.free(transaction.order_id); for (var i = 0; i < 6; i++) { -- cgit v1.2.3