summaryrefslogtreecommitdiff
path: root/midtrans.dart
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-11-03 17:29:40 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-11-03 17:29:40 +0800
commit644d7860b962e1e272ef4e5682d1cc68fa0609ad (patch)
treeb1aa9958603f15fd5b355fb40e4dbc590e7195af /midtrans.dart
parentf663d2a9dceca5ae4f594411a118779c04cec939 (diff)
dylib initialisation is done outside of constructor
Diffstat (limited to 'midtrans.dart')
-rw-r--r--midtrans.dart7
1 files changed, 2 insertions, 5 deletions
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<Pointer<Utf8>>);
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