From 644d7860b962e1e272ef4e5682d1cc68fa0609ad 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: Thu, 3 Nov 2022 17:29:40 +0800 Subject: dylib initialisation is done outside of constructor --- midtrans.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'midtrans.dart') diff --git a/midtrans.dart b/midtrans.dart index 3fa0ea8..4476477 100644 --- a/midtrans.dart +++ b/midtrans.dart @@ -23,13 +23,10 @@ typedef MidtransChargeBanktransfer Array>); class Midtrans { - DynamicLibrary dylib; + final dylib = Platform.isAndroid ? DynamicLibrary.open('libmidtrans.so') + : DynamicLibrary.process();; Midtrans(String apiKey, String pem) { - dylib = Platform.isAndroid - ? DynamicLibrary.open('libmidtrans.so') - : DynamicLibrary.process(); - final apiKeyUtf8 = apiKey.toNativeUtf8(); final pemUtf8 = pem.toNativeUtf8(); final midtrans_init = dylib.lookupFunction -- cgit v1.2.3