examples/flutter/RunAnywhereAI/README.md
A cross-platform reference app for the RunAnywhere Flutter SDK. LLM chat, speech, vision, voice agents, RAG, tools, and model management via Dart FFI—mirroring the native iOS example's feature set.
| Item | Minimum |
|---|---|
| Flutter | 3.44.6+ (Dart 3.12.2+) |
| Android Studio | SDK 24+, NDK; ANDROID_HOME and ANDROID_NDK_HOME set |
| Xcode | 26+ and CocoaPods (iOS builds) |
| JDK | 17 |
| Disk space | Several GB for native artifacts and AI models |
| Device | ARM64 physical device recommended (required for Apple MLX) |
Important: This sample uses local
path:dependencies on Flutter SDK packages. A clean clone must stage Android JNI libraries and iOS XCFrameworks into those packages before the app will build.
git clone https://github.com/RunanywhereAI/runanywhere-sdks.git
cd runanywhere-sdks/examples/flutter/RunAnywhereAI
flutter pub get
cd ../../..
./scripts/build/build-core-android.sh arm64-v8a
./sdk/runanywhere-swift/scripts/build-core-xcframework.sh
cd examples/flutter/RunAnywhereAI
.so files land in sdk/runanywhere-flutter/packages/*/android/src/main/jniLibs/.ios/<package>/Frameworks/ directory.runanywhere.useLocalNatives=true in android/gradle.properties.Re-run after any C++ change in runanywhere-commons.
flutter analyze
flutter build apk --debug
flutter build ios --simulator --debug
If iOS Pods are stale after pub get:
cd ios && pod install && cd ..
Or run the combined gate:
./scripts/verify.sh # APK + analyze; RUN_IOS=1 for iOS build too
flutter run # Connected device or emulator
flutter run -d "iPhone 16 Pro" # Specific iOS simulator
Open in VS Code or Android Studio, select a target, and press Run.
| Change | Action |
|---|---|
| Dart SDK | Hot reload for most UI changes; restart for native init changes |
| C++ / commons | Re-run both root native build scripts from step 2 |
| Feature | Description |
|---|---|
| AI Chat | Streaming and batch LLM with thinking-mode parsing |
| Apple MLX | LLM, VLM, embeddings, STT, TTS on physical iOS devices |
| Speech-to-Text | Batch and live transcription |
| Text-to-Speech | Piper ONNX voices with playback controls |
| Voice Assistant | STT → LLM → TTS via RunAnywhere.voice event stream |
| Vision (VLM) | Camera auto-stream and photo capture |
| RAG | PDF ingestion and document Q&A |
| Tools & Structured Output | Tool calling and JSON schema generation |
| Solutions | YAML pipeline demos |
| Model Management | Download, load, storage, deletion |
MLX registers only on physical iOS hardware; the arm64 simulator validates compile/link/startup but does not run MLX inference.
The runanywhere_qhexrt package accelerates inference on supported Snapdragon/Hexagon devices. QHexRT native libraries are private local artifacts—stage them into sdk/runanywhere-flutter/packages/runanywhere_qhexrt/android/src/main/jniLibs/arm64-v8a/ before building; do not commit them.
To test private HNPU bundles: Settings → Downloads → save a Hugging Face token → download/load an HNPU model → Clear to revert to public downloads. Token is passed via RunAnywhere.setHfToken(...) at runtime.
RunAnywhereAI/
├── lib/
│ ├── app/ # runanywhere_ai_app.dart, ContentView tabs
│ ├── features/ # chat, voice, vision, rag, tools, settings, …
│ ├── core/
│ │ ├── design_system/ # AppColors (#FF6900), typography, spacing
│ │ └── services/ # Audio, conversation store, permissions
│ └── helpers/
├── pubspec.yaml # path: deps → sdk/runanywhere-flutter/packages/*
├── android/ # minSdk 24, packagingOptions for duplicate .so
├── ios/ # Podfile, deployment target 17.5
├── scripts/
│ ├── verify.sh
│ └── smoke.sh
└── README.md
AI calls go through RunAnywhere.* facades over Dart FFI—no platform-channel hop for inference.
| Symptom | Fix |
|---|---|
| Missing native library errors | Re-run root native build scripts; confirm runanywhere.useLocalNatives=true |
| iOS Pod / arch errors | cd ios && pod install; xcframeworks are arm64-only (x86_64 simulator excluded) |
| Gradle OOM | -Xmx6g is set in gradle.properties; close other Gradle daemons |
| MLX unavailable | Use a physical iOS device |
| Analysis failures | flutter analyze — strict mode treats unused imports as errors |
Quick static check:
./scripts/smoke.sh
flutter test
| Resource | Link |
|---|---|
| Flutter SDK | sdk/runanywhere-flutter/README.md |
| iOS example | examples/ios/RunAnywhereAI |
| Android example | examples/android/RunAnywhereAI |
| React Native example | examples/react-native/RunAnywhereAI |
| App Store / Play Store | iOS · Android |
| Discord | discord.gg/N359FBbDVd |
| Issues | GitHub Issues |
| [email protected] |
This project is licensed under the RunAnywhere License (Apache 2.0 based, with additional commercial-use terms). See LICENSE for details.