mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-23 17:04:25 +01:00
Move dart & flutter packages to packages folder on root
This commit is contained in:
41
packages/dart/test/helpers.io.dart
Normal file
41
packages/dart/test/helpers.io.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
import 'package:breez_liquid/breez_liquid.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
final hostTriple = () {
|
||||
final result = Process.runSync('rustc', const ['-vV']);
|
||||
|
||||
return (result.stdout as String)
|
||||
.split('\n')
|
||||
.firstWhere((line) => line.startsWith('host:'))
|
||||
.split(':')
|
||||
.last
|
||||
.trim();
|
||||
}();
|
||||
|
||||
extension on String {
|
||||
String get dylib {
|
||||
if (Platform.isWindows) {
|
||||
return '$this.dll';
|
||||
}
|
||||
if (Platform.isMacOS) {
|
||||
return 'lib$this.dylib';
|
||||
}
|
||||
return 'lib$this.so';
|
||||
}
|
||||
}
|
||||
|
||||
String dylibPath(String profile) => Uri.base
|
||||
.resolve(p.joinAll([
|
||||
'../../target',
|
||||
if (Platform.isMacOS && hostTriple.startsWith('aarch64')) hostTriple,
|
||||
profile,
|
||||
'breez_liquid_sdk'.dylib,
|
||||
]))
|
||||
.toFilePath();
|
||||
|
||||
Future<void> initApi({String profile = 'debug'}) {
|
||||
return initialize(dylib: ExternalLibrary.open(dylibPath(profile)));
|
||||
}
|
||||
Reference in New Issue
Block a user