betto_onnxrt_ios 0.1.0
betto_onnxrt_ios: ^0.1.0 copied to clipboard
Flutter plugin shim that links ORT via SPM on iOS for betto_onnxrt. The plugin declares an SPM dependency on microsoft/onnxruntime-swift-package-manager (onnxruntime), which causes Xcode to staticall [...]
betto_onnxrt_ios #
iOS companion plugin for betto_onnxrt.
betto_onnxrt is a pure-Dart package and therefore cannot declare a native
iOS dependency itself. This Flutter plugin exists to bridge that gap: it
declares a Swift Package Manager (SPM) dependency on
microsoft/onnxruntime-swift-package-manager,
causing Xcode to statically link the ONNX Runtime XCFramework into the host
app binary. betto_onnxrt then resolves ORT symbols at runtime via
DynamicLibrary.process().
Add this package to any Flutter iOS app that uses betto_onnxrt. No
CocoaPods or Podfile changes are needed — Flutter's SPM integration handles
everything.
Installation #
Add both packages to your pubspec.yaml:
dependencies:
betto_onnxrt: ^0.1.0
betto_onnxrt_ios: ^0.1.0
Requires Flutter ≥ 3.27.0 (SPM plugin support was stabilised in Flutter 3.24; 3.27 is the version betto_onnxrt_ios was developed and tested against).
How it works #
- Flutter's SPM tooling detects
ios/betto_onnxrt_ios/Package.swiftin this plugin and adds it to the generatedFlutterGeneratedPluginSwiftPackage. - Xcode resolves the
onnxruntimeproduct fromonnxruntime-swift-package-manager(pinned atexact: "1.24.2") and statically links the XCFramework into theRunnerbinary. - At runtime,
OnnxRuntime.load()callsDynamicLibrary.process()to resolveOrtGetApiBasefrom the process image — no.dylibis opened. betto_onnxrt's native-assets hook emits noCodeAsseton iOS; the ORT binary is delivered entirely through this plugin's SPM dependency.
Version alignment #
The SPM tag (1.24.2) is intentionally newer than the betto_onnxrt
baseline ORT version (1.22.0). The
microsoft/onnxruntime-swift-package-manager repository has no tags between
1.20.0 and 1.24.1, so 1.24.2 is the earliest available SPM release that
satisfies >= 1.22.0. The ORT C API is additive: requesting API version 22
from an ORT 1.24.2 binary returns the same vtable struct as 1.22.x.
License #
Apache License, Version 2.0 — see LICENSE.