mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-02-23 15:04:22 +01:00
Attempt to load breez liquid library via ExternalLibrary.process() if it fails to load (#357)
process() resolves any symbol in a library currently loaded with global visibility.
This commit is contained in:
@@ -6,12 +6,23 @@ export 'src/model.dart';
|
||||
export 'src/error.dart';
|
||||
export 'src/bindings/duplicates.dart';
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
import 'src/frb_generated.dart';
|
||||
|
||||
typedef BreezLiquid = RustLibApi;
|
||||
typedef BreezLiquidImpl = RustLibApiImpl;
|
||||
|
||||
const libName = 'breez_liquid_sdk';
|
||||
|
||||
Future<void> initialize({ExternalLibrary? dylib}) {
|
||||
if (dylib == null && (Platform.isIOS || Platform.isMacOS)) {
|
||||
try {
|
||||
dylib = ExternalLibrary.open("$libName.framework/$libName");
|
||||
} catch (e) {
|
||||
dylib = ExternalLibrary.process(iKnowHowToUseIt: true);
|
||||
}
|
||||
}
|
||||
return RustLib.init(externalLibrary: dylib);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user