Skip to content
pubscout

flutter_gen_ai_chat_ui

2.22.0, released 5 weeks ago by dilacode.com

Flutter UI kit for AI chat applications with streaming markdown, LaTeX, and tool calls.

WASM-readyRock solid
$ flutter pub add flutter_gen_ai_chat_ui
Source repository

What it does

Provides a customizable chat interface designed for LLMs like ChatGPT, Claude, and Gemini. Features built-in word-by-word streaming responses, markdown and syntax highlighting, LaTeX rendering, rich inline widgets, and RTL layout support.

AI-written summary of version 2.22.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Building an AI chat or assistant application in Flutter
  • Needing out-of-the-box word-by-word text streaming and markdown code block rendering
  • Integrating AI function-calling or human-in-the-loop action surfaces

Skip it when

  • Building a general-purpose peer-to-peer messaging app with no AI features
  • Needing an ultra-lightweight text component without a full chat interface

Strengths

  • Built-in word-by-word streaming animation for AI responses
  • Enhanced markdown and syntax highlighting without extra dependencies
  • RTL language support out of the box
  • Rich inline widget rendering and AI action/tool-use surfaces

Weaknesses

  • Tightly scoped to AI chat use cases rather than general messaging
  • Requires managing your own model backend connection

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
6
import 'package:flutter/material.dart';
import 'package:flutter_gen_ai_chat_ui/flutter_gen_ai_chat_ui.dart';

void main() => runApp(const MaterialApp(home: ChatScreen()));

class ChatScreen extends StatefulWidget {
  const ChatScreen({super.key});

  @override
  State<ChatScreen> createState() => _ChatScreenState();
}

class _ChatScreenState extends State<ChatScreen> {
  final _controller = ChatMessagesController();
  static const _user = ChatUser(id: 'user', name: 'You');
  static const _ai = ChatUser(id: 'ai', name: 'Assistant');

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: AiChatWidget(
        currentUser: _user,
        aiUser: _ai,
        controller: _controller,
        onSendMessage: (message) {
          _controller.addMessage(message);
          _controller.streamResponse(fakeLlmReply(message.text), user: _ai);
        },
        welcomeMessageConfig: const WelcomeMessageConfig(
          title: 'Ask me anything',
        ),
      ),
    );
  }
}

Stream<String> fakeLlmReply(String prompt) async* {
  yield 'You asked: $prompt';
}

Alternatives

Packages that do the same job and could replace flutter_gen_ai_chat_ui.

  • flutter_chat_ui

    Choose this instead if you are building general-purpose, peer-to-peer chat without AI-specific features.

Works with

Packages commonly used together with flutter_gen_ai_chat_ui: ones it builds on, ones built on it, and its own family.