flutter_local_ai
0.4.0, released 11 days ago by vezz.io
Unified API for on-device AI inference using native OS models.
What it does
Provides a unified API for on-device AI inference utilizing Apple Foundation Models, Android Gemini Nano, Windows AI APIs, and Chrome Prompt API. Supports text generation, streaming, structured JSON outputs, tool calling, and generative UI specs without bundled model checkpoints.
AI-written summary of version 0.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need on-device AI inference using OS-managed models to save app size
- You want native tool calling and structured schema outputs
- You need generative UI capabilities driven locally
Skip it when
- You require custom model checkpoints bundled directly with your app
- You need full feature parity across all platforms including older OS versions
Strengths
- No app-bundled model checkpoints, reducing app download size
- Leverages native OS-optimized AI capabilities and hardware acceleration
- Unified API across iOS, Android, Windows, macOS, and Web
Weaknesses
- Platform support requires specific modern OS versions and hardware
- Some features like tool calling or image inputs are platform-dependent and limited
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 1
Requires high minimum OS/hardware requirements (iOS/macOS 26+, Android API 26+, Windows 11 25H2 Copilot+ PC, Chrome 148+). Android requires specific Kotlin versions. Windows requires MSIX packaging and runtime configuration.
await LocalAi.ensureReady(onProgress: (p) => debugPrint('$p%'));
final model = await LocalAiModel.create(maxTokens: 4096);
final session = await model.openSession(systemInstruction: 'Be concise.');
await session.addQueryChunk('Summarize this in one line: ...');
await for (final chunk in session.getResponseAsync()) {
stdout.write(chunk);
}
await session.close();
await model.close();Alternatives
Packages that do the same job and could replace flutter_local_ai.
- firebase_ai
If you prefer cloud-based Gemini models via Firebase instead of relying on device hardware constraints.
86Compare - tflite_flutter
If you want to bundle custom TensorFlow Lite models directly within your app rather than depending on OS-managed models.
68Compare - llamadart
If you want to run LLaMA models locally via native bindings instead of system-provided AI frameworks.
93Compare
Works with
Packages commonly used together with flutter_local_ai: ones it builds on, ones built on it, and its own family.