On-device LLM inference for Flutter and Dart
Run LLMs on the device, from one Dart API
llamadart runs GGUF (llama.cpp) and LiteRT-LM models inside your app on Android, iOS, macOS, Linux, Windows and the web. Prompts stay on the device, there is no inference server or API key, and native apps work offline once the model is downloaded.
$ dart pub add llamadart
import 'dart:io';
import 'package:llamadart/llamadart.dart';
Future<void> main() async {
final engine = await LlamaEngine.load(
LlamaModel(
ModelSource.parse(
'hf://unsloth/SmolLM2-135M-Instruct-GGUF/'
'SmolLM2-135M-Instruct-Q2_K.gguf',
),
),
);
final chat = ChatSession(engine, systemPrompt: 'You are concise.');
await for (final chunk in chat.create([
const LlamaTextContent('What is quantization?'),
])) {
stdout.write(chunk.text);
}
await engine.dispose();
}
Platforms
- Android
- iOS
- macOS
- Linux
- Windows
- Web
Runtimes
- llama.cpp · GGUF
- LiteRT-LM · .litertlm
What you can build
Chat and streaming
Stateless completions with LlamaEngine, or multi-turn history with ChatSession, streamed as chunks.
Tool calling
Let the model call your Dart functions and handle the calls.
Embeddings
Generate local embeddings for retrieval-style workflows.
Multimodal
Prompt with images and text, within each platform's limits.
Speech to textexperimental
Transcribe audio with the typed speech API.
Text to speechexperimental
Generate PCM and WAV audio with Qwen3-TTS on native and WebGPU.
Image generationpreview
Generate images from text prompts on native platforms with the opt-in stable-diffusion.cpp runtime.