cera_ffi_flutter 0.5.4
cera_ffi_flutter: ^0.5.4 copied to clipboard
Flutter FFI plugin for the Cera on-device inference engine. Ships prebuilt native libraries for Android, iOS, macOS, Linux and Windows.
Changelog #
0.5.4 #
Changed #
- Version Alignment: Bumped dependency on
cera_ffito0.5.4and aligned platform manifests across Android, iOS, macOS, Linux, and Windows.
0.5.3 #
Added #
- Streaming Text Chunks: Re-exported
generateStreamChunksfor batched token streaming in Flutter UI pipelines. - Multimodal Envelopes: Re-exported
MultimodalEnvelope,ImageInput, andAudioInputfor multimodal inference. - Android Model Download Service: Android background service integration for downloading model assets.
Changed #
- Version Alignment: Bumped dependency on
cera_ffito0.5.3and aligned platform manifests across Android, iOS, macOS, Linux, and Windows.
0.5.2 #
Added #
- Web Platform Support: Registered the
webplatform inpubspec.yamlvia a lightweight plugin registrant (CeraFfiFlutterWeb) so pub.dev and Flutter tooling officially recognise Web platform support for the plugin.
0.5.1 #
Added #
- WebGPU Dense Transformer Support: Native WebGPU acceleration for dense transformer architectures (
llama,qwen2,qwen3,granite) alongside LFM2 models. - License Formatting: Cleaned dual Apache-2.0 / MIT license formatting for full OSI license scoring on pub.dev.
0.5.0 #
Added #
- Silero VAD v5 integration: Re-exports native Silero VAD v5 classes (
FfiSileroVad,FfiVadSampleRate,FfiVadIterator,FfiVadConfig,sileroVadDefaultConfig) for audio activity detection in Flutter apps. - Modern MVI UI Architecture: Complete architectural rewrite of the Flutter example application using Model-View-Intent pattern for predictable state transitions and lifecycle management.
- Voice Interaction Modes: 4 dedicated interaction modes (
SpeechToText,VoiceChat,TextToSpeech, andTextOnly) with capability-based mode switching, dynamic audio waveforms, and exclusive audio streaming playback viaAudioPlayerService. - Hugging Face Model Repositories: Support for downloading and loading models directly from arbitrary Hugging Face repositories and URLs in addition to LeapBundles.
- WebGPU Depthformer Acceleration: High-performance compute shaders for Depthformer audio decoder running seamlessly on WebGPU in web builds.
0.4.0 #
First release to pub.dev. The package existed in-tree before this, but was
marked publish_to: none and was not a Flutter plugin.
Changed #
- The Dart API moved to the new
cera_ffipackage, which this one now depends on and re-exports.import 'package:cera_ffi_flutter/cera_ffi_flutter.dart'is unchanged and still gives you everything. The split exists because pub refuses to publish a package declaringflutter.plugin.platformswithout a Flutter SDK constraint, and declaring that constraint makesdart pub getrefuse the package: one package could not be both a plugin and usable from plain Dart.
Added #
- Flutter FFI plugin support for Android, iOS, macOS, Linux, and Windows.
Each platform resolves the prebuilt native library from an already-published
release artifact, so app developers need neither a Rust toolchain nor the
Android NDK: the
cera-ffi-androidAAR via Gradle,CeraFFI.xcframeworkvia a CocoaPods podspec and a Swift Package Manager manifest, and the desktop cdylibs via CMake with a SHA-256 check. - Web support, through the
CeraAPI re-exported fromcera_ffi: WebGPU where the browser has it, a wasm CPU build where it does not. Install the runtime once withdart run cera_ffi_flutter:install_web. - Flutter example app (
example/), one code path for every platform including the web, plus plain-Dart CLI examples, which ship withcera_ffi. - Standalone Linux and Windows cdylib release assets.
Fixed #
-
Four engine methods segfaulted the process.
bosToken,eosToken,specialTokenIdandtoolCallStartTokenreturnOption<u32>, which UniFFI passes back as a RustBuffer; the generator special-cased optional primitives as a JSON-encoded C string and dereferenced the buffer's capacity word as a pointer. SIGSEGV, no exception, nothing an analyzer could see. No caller had reached one untilCeraneeded BOS framing. -
Eleven engine methods threw
UnsupportedErrorat runtime. The Dart generator's object-method renderer decoded only records, enums, and maps, so every other RustBuffer return became a stub. That took outdecodeTokens,encodeText,encodeTextSpecial,applyChatTemplate,applyChatTemplateWithTools,transcribe,toolFormat, and thehiddenStates*family. WithdecodeTokensamong them there was no way to turn agenerateresult into text from Dart at all. -
fromBundleIdAsyncthrewUnsupportedError. The generator drove the rust-future poll/complete lifecycle for object methods but not for constructors, so async constructors fell through to a stub even though their ffi-buffer trampoline was exported. -
The committed bindings had drifted behind the Rust FFI surface, which makes UniFFI's per-method checksum verification fail at construction: the package threw
StateErrorbefore any call.just dart-bindings-checknow runs in CI, along with an assertion that no generated method is a stub. -
Apple frameworks are now dynamic rather than static. A static archive contributes nothing to a Dart FFI consumer, which resolves symbols at runtime: the linker pulled in no members and every lookup failed.
-
The prebuilt native libraries carried no
uniffi_ffibuffer_*trampolines, so every Dart call failed atdlsymon all five platforms. They were built for the Kotlin and Swift bindings, which call the standard scaffolding; only Dart uses the trampolines, and UniFFI emits them solely under theffi-bufferfeature. Every build now enables it and asserts the result. -
Vec UniFFI encodes it as an
i32length then the bytes. Passing one panicked; returning one silently prepended four junk bytes, sohiddenStatesFor*reported 1025 floats for a 1024-wide model.appendImagewas affected too. -
The Android module declared
minSdk 24andcompileSdk 35against an AAR published at 28 and consumers compiling against 36, so every app using the plugin failed to build at the manifest merger.
Notes #
- Requires iOS 15.0+ / macOS 12.0+ / Android API 28+. An app left at Flutter's default deployment target fails with an SPM error that does not name the fix; see the README.
- Web inference goes through
Ceraand needs its runtime installed once withdart run cera_ffi_flutter:install_web. The GPU path supports LFM2 and dense transformers (llama,qwen2,qwen3,granite); other architectures fall back to the wasm CPU build.openPathis unavailable there (no filesystem),resetis unavailable on the GPU backend, andcancelis best-effort. The generated bindings remain native-only: their web branch is a stub whose every engine call throwsUnsupportedError.