openAimuxLibrary function

DynamicLibrary openAimuxLibrary()

Opens the aimux-ffi native library for the current platform.

The library ships inside this Flutter plugin package:

  • Android: libaimux_ffi.so per ABI under android/src/main/jniLibs, loaded by name (the Android build system bundles it into the APK).
  • iOS: libaimux_ffi.a is statically linked into the app binary via ios/aimux.podspec (vendored + force_load), so symbols resolve from the process itself.
  • Desktop: looked up on the platform library path (dev/test usage).

Implementation

DynamicLibrary openAimuxLibrary() {
  if (Platform.isAndroid) return DynamicLibrary.open('libaimux_ffi.so');
  if (Platform.isIOS) return DynamicLibrary.process();
  if (Platform.isLinux) return DynamicLibrary.open('libaimux_ffi.so');
  if (Platform.isMacOS) return DynamicLibrary.open('libaimux_ffi.dylib');
  if (Platform.isWindows) return DynamicLibrary.open('aimux_ffi.dll');
  throw StateError('Unsupported platform');
}