RaptrAI
The opinionated AI UI + runtime toolkit for Flutter. Like shadcn/ui for AI apps.
Install
flutter pub add raptrai
30 Seconds to AI Chat
import 'package:flutter/material.dart';
import 'package:raptrai/raptrai.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: RaptrAITheme.dark(),
home: Scaffold(
body: RaptrAIChat(
provider: RaptrAIOpenAI(apiKey: 'sk-...'),
),
),
);
}
}
That's it. Streaming, tool calling, conversation management, theming — all built in.
Examples
Copy, change API key, run:
| Example | Description |
|---|---|
| basic_chat | Minimal AI chat in ~40 lines |
| tool_calling | Weather + calculator function calling |
| multi_thread | Conversation history with sidebar |
Providers
// OpenAI
RaptrAIChat(provider: RaptrAIOpenAI(apiKey: 'sk-...'))
// Anthropic Claude
RaptrAIChat(provider: RaptrAIAnthropic(apiKey: 'sk-ant-...'))
// Google Gemini
RaptrAIChat(provider: RaptrAIGoogle(apiKey: 'AIza...'))
Tool Calling
final tool = RaptrAIToolBuilder('get_weather')
.description('Get weather for a location')
.addStringParam('location', required: true)
.handler((args) async => {'temp': 72, 'condition': 'sunny'})
.build();
registry.register(tool);
RaptrAIChat(
provider: openai,
tools: registry.definitions,
toolRegistry: registry,
)
Persistence
// In-memory (testing)
RaptrAIChat(storage: RaptrAIMemoryStorage())
// Local persistence
RaptrAIChat(storage: RaptrAIHiveStorage())
Extend
| Guide | What you'll learn |
|---|---|
| PROVIDERS.md | Add a custom AI provider |
| STORAGE.md | Implement custom persistence |
| TOOLS.md | Create and customize tools |
| THEMING.md | Override message rendering |
CLI (Templates)
Add pre-built screens to your project:
# List available templates
dart run raptrai list
# Add a template
dart run raptrai add basic-chat
dart run raptrai add tool-calling --path lib/features/ai
dart run raptrai add multi-thread
API Reference
Full documentation: raptrai.raptrx.com
Roadmap
- More providers — Community-driven integrations
- More templates — Real-world app patterns
- Stability & DX — Polish based on feedback
License
MIT License - raptrx.com
Libraries
- cli/cli
- cli/commands/add_command
- cli/commands/init_command
- cli/commands/list_command
- cli/templates/basic_chat
- cli/templates/multi_thread
- cli/templates/registry
- cli/templates/tool_calling
- cli/utils/console
- cli/utils/file_writer
- cli/utils/pubspec
- raptrai
- Flutter RaptrAI - Complete AI Framework for Flutter.
- widgets/raptrai_chat
- High-level chat widget that combines all RaptrAI features.