flutter /ai

★ 299⑂ 97👁 39⑃ 107● 99▤ 4
DartBSD-3-ClauseCreated 2024-09-12
More from this author
Download: v0.9.2v0.9.2 ↓0.9.22025-07-17
+0
Daily
299
stars
97
forks
39
watchers
107
prs
99
issues
4
releases

README

Hello and welcome to the [Flutter AI Toolkit][]!

The AI Toolkit is a set of AI chat-related widgets to make it easy to add an AI
chat window to your Flutter app. The AI Toolkit is organized around an abstract
LLM provider API that makes it easy to swap out the LLM provider that you'd like
your chat provider to use. Out of the box, it comes with support for one LLM
provider integration: [Firebase AI][].

[Flutter AI Toolkit]: https://docs.flutter.dev/ai-toolkit
[Firebase AI]: https://firebase.google.com/docs/vertex-ai

 Key features

 Multi-turn chat:
  Maintains context across multiple interactions.
 Streaming responses:
  Displays AI responses in real-time as they're generated.
 Rich text display:
  Supports formatted text in chat messages.
 Voice input:
  Allows users to input prompts using speech.
 Multimedia attachments:
  Enables sending and receiving various media types.
 Custom styling:
  Offers extensive customization to match your app's design.
 Chat serialization/deserialization:
  Store and retrieve conversations between app sessions.
 Pluggable LLM support:
  Implement a simple interface to plug in your own LLM.
 Cross-platform support:
  Compatible with the Android, iOS, web, and macOS platforms.

 Getting started

 1. Installation

    Add the following dependencies to your pubspec.yaml file:

    sh
    $ flutter pub add flutter_ai_toolkit firebase_ai firebase_core
    

 2. Configuration

    To use Firebase AI in your project, follow the steps described in Get
    started with the Gemini API using the Firebase AI Logic SDKs.

    After following these instructions, you're ready to use Firebase AI in your
    Flutter app. Start by initializing Firebase:

    dart
    import 'package:firebase_core/firebase_core.dart';
    import 'package:firebase_vertexai/firebase_ai.dart';
    import 'package:flutter_ai_toolkit/flutter_ai_toolkit.dart';

    // Other app imports...

    import 'firebase_options.dart'; // Generated by flutterfire config.

    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
      runApp(const App());
    }

    // Implementation of App and other widgets...
    

    With Firebase properly initialized in your Flutter app, you're now ready to
    create an instance of the Firebase provider:

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

      @override
      Widget build(BuildContext context) = Scaffold(
        appBar: AppBar(title: const Text(App.title)),
        body: LlmChatView(
          provider: FirebaseProvider(
            model: FirebaseAI.vertexAI().generativeModel(
              model: 'gemini-2.0-flash'
            ),
          ),
        ),
      );
    }
    

    The FirebaseAI class comes from the firebase_ai package. The AI Toolkit
    provides the FirebaseProvider class to expose Firebase AI to the
    LlmChatView. Note that you provide a model name 

Top issues

Latest release

v0.9.2 v0.9.2 2025-07-17
0.9.2

- fix 137: Link Attachments are not
  supported. This prevented the use of a messageSender function to upload
  files on the fly when making requests to certain providers (I'm looking at
  you, Firebase) that require larger (ok, really just not tiny) files to be
  uploaded before they can be processed. Check out simulated upload in the new
  file update example.

- fix 112: attachments pop-up menu
  appears behind soft keyboard on mobile

- fix 133: Avoiding autofocus

- fix 127: stt should strip
  newlines

- fix 100: audio
  transcription returns mixed AI response or

Snapshot: 2026-11-27T22:26:53Z · Data license Apache-2.0 · JSON