chatbotify 0.1.1
chatbotify: ^0.1.1 copied to clipboard
A plug-and-play AI chatbot package for Flutter with support for Gemini and OpenAI, streaming responses, Markdown rendering, theming, and pluggable storage. Minimal setup, production-ready UI.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:chatbotify/chatbotify.dart';
void main() {
AiChatbot.initialize(
provider: AIProvider.gemini,
apiKey: const String.fromEnvironment('AI_API_KEY', defaultValue: 'YOUR_API_KEY'),
systemPrompt: 'You are a friendly, concise assistant for a demo app.',
);
runApp(const ProviderScope(child: MyApp()));
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
/// Matches Romind: default to dark.
ThemeMode _themeMode = ThemeMode.dark;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'chatbotify example',
debugShowCheckedModeBanner: false,
theme: ChatbotAppTheme.light,
darkTheme: ChatbotAppTheme.dark,
themeMode: _themeMode,
home: AiChatScreen(
title: 'Chatbotify',
showThemeToggle: true,
isDarkMode: _themeMode == ThemeMode.dark,
onToggleTheme: () {
setState(() {
_themeMode = _themeMode == ThemeMode.dark
? ThemeMode.light
: ThemeMode.dark;
});
},
),
);
}
}