on_device_ai 0.2.1
on_device_ai: ^0.2.1 copied to clipboard
A cross-platform Flutter plugin for on-device AI/ML inference. Supports text sentiment analysis and image classification using Apple frameworks (iOS) and TensorFlow Lite (Android).
0.2.1 #
- Fixed pub.dev platform score warning by relocating
Package.swifttoios/on_device_ai/Package.swiftandmacos/on_device_ai/Package.swiftto strictly follow Flutter's Swift Package Manager structure guidelines.
0.2.0 #
- Added macOS platform support (macOS 11.0+) utilizing
NSImageand native Apple frameworks (AppKit,Vision,NaturalLanguage). - Updated example app to include a macOS runner with file picking support.
0.1.2 #
iOS Improvements #
- Added Swift Package Manager (SPM) support via
ios/Package.swift. The plugin now works in Xcode projects that use SPM instead of CocoaPods, resolving the pub.dev platform score warning. - Updated
on_device_ai.podspecwith correct version number (0.1.2), accurate description, and explicit declarations for theNaturalLanguage,Vision, andCoreMLsystem frameworks.
0.1.1 #
Documentation #
- Added full
dartdoccomments to all public API elements:AIResult,ModelConfig,OnDeviceAi, andOnDeviceAiPlatform. This satisfies the pub.dev documentation score requirement (≥20% of public API elements documented).
0.1.0 #
New Features #
- Image Classification (
runImage): Pass an image byte array and receive an on-device classification result (e.g. "Golden Retriever: 94%") with no internet connection.- Android: Uses a bundled MobileNet V1 quantized TFLite model (~4MB) via the stable base
tensorflow-lite:2.11.0interpreter. - iOS: Uses Apple's built-in
Visionframework (VNClassifyImageRequest) — zero model downloads required.
- Android: Uses a bundled MobileNet V1 quantized TFLite model (~4MB) via the stable base
- Multimodal Example App: The example app now includes an image picker UI to test both text and image AI pipelines on the same screen.
Improvements #
- Android threading: All TFLite operations (
loadModel,runText,runImage,dispose) now run on a backgroundDispatchers.IOcoroutine to prevent UI-thread blocking. - iOS sentiment reliability: Fixed a bug where
NLTaggeralways returned "Neutral" by switching fromtag(at:)toenumerateTagsand explicitly forcing the.englishlanguage tag.
Bug Fixes #
- Fixed a native JNI crash (
SIGSEGVinlibtask_vision_jni.so) on Android 10 devices caused bytensorflow-lite-task-vision:0.4.4. Replaced with a stable manual inference pipeline usingtensorflow-lite:2.11.0. - Fixed a Gradle build failure (
Plugin [id: 'com.android.library'] was not found) by migrating the Android plugin build script from Kotlin DSL (build.gradle.kts) to Groovy (build.gradle).
0.0.1 #
- Initial release.
- Support for on-device Text Inference via Core ML (iOS) and TensorFlow Lite (Android).
- Unified Dart API for model loading, text inference, and streaming.