chatbotify 0.1.0 copy "chatbotify: ^0.1.0" to clipboard
chatbotify: ^0.1.0 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() {
  // 1. Initialize once, before runApp. Swap AIProvider.gemini for
  //    AIProvider.openai to use OpenAI instead — nothing else changes.
  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.',
    themeConfig: const ChatTheme(
      borderRadius: 20,
    ),
  );

  // 2. Riverpod's ProviderScope must wrap the app.
  runApp(const ProviderScope(child: MyApp()));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'chatbotify example',
      theme: ThemeData(colorSchemeSeed: Colors.deepPurple, useMaterial3: true),
      darkTheme: ThemeData(
        colorSchemeSeed: Colors.deepPurple,
        brightness: Brightness.dark,
        useMaterial3: true,
      ),
      themeMode: ThemeMode.system,
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('chatbotify demo')),
      body: Center(
        child: ElevatedButton.icon(
          icon: const Icon(Icons.smart_toy_outlined),
          label: const Text('Open AI Chat'),
          onPressed: () {
            // 3. Drop the ready-made screen in anywhere.
            Navigator.of(context).push(
              MaterialPageRoute(builder: (_) => const AiChatScreen()),
            );
          },
        ),
      ),
    );
  }
}
0
likes
140
points
32
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

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.

Repository (GitHub)
View/report issues

Topics

#chatbot #ai #gemini #openai #chat

License

MIT (license)

Dependencies

flutter, flutter_markdown, flutter_riverpod, http, uuid

More

Packages that depend on chatbotify