runanywhere-sdks

RunAnywhere AI — Flutter Example

RunAnywhere Logo

Download on App Store Get it on Google Play

iOS 17.5+ | Android API 24+ Flutter 3.44.6+ Dart 3.12.2+ RunAnywhere License

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.


Requirements

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)

Setup

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.

1. Clone and resolve packages

git clone https://github.com/RunanywhereAI/runanywhere-sdks.git
cd runanywhere-sdks/bindings/flutter/example

flutter pub get

2. Build and stage native artifacts (repo root)

cd ../../..
./scripts/build/build-core-android.sh arm64-v8a
./bindings/swift/scripts/build-core-xcframework.sh
cd bindings/flutter/example

Re-run after any C++ change in runanywhere-commons.

3. Verify and build

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

4. Run the app

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.

After modifying the SDK

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

Features

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.


NPU / QHexRT (Android)

The runanywhere_qhexrt package accelerates inference on supported Snapdragon/Hexagon devices. QHexRT native libraries are private local artifacts—stage them into bindings/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.


Project structure

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 → bindings/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.


Troubleshooting

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 bindings/flutter/README.md
iOS example RunanywhereAI/runanywhere-ios
Android example RunanywhereAI/runanywhere-android
React Native example bindings/react-native/example
App Store / Play Store iOS · Android
Discord discord.gg/N359FBbDVd
Issues GitHub Issues
Email founders@runanywhere.ai

License

This project is licensed under the RunAnywhere License (Apache 2.0 based, with additional commercial-use terms). See LICENSE for details.