Skip to content
pubscout

swifty_chat

4.1.0, released 5 days ago by an unverified publisher

Flutter package to build chat UIs with multiple message kinds like text, image, HTML, and carousels.

WASM-readyUses material_ui
$ flutter pub add swifty_chat
Source repository

What it does

Provides a comprehensive set of widgets and controllers to build chat interfaces supporting multiple message types, quick replies, carousels, custom messages, and built-in themes. It handles message rendering, scrolling, and input fields out of the box.

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

Use it when

  • You need to quickly implement a chat interface with support for various message types like text, images, and HTML.
  • You want built-in support for quick replies, carousels, and custom message rendering.

Skip it when

  • You require a fully custom chat layout that drastically diverges from standard chat bubble paradigms.
  • You are using a Flutter version older than 3.41.0.

Strengths

  • Supports multiple message kinds including text, image, HTML, quick replies, and carousels.
  • Includes M3 design system integration and responsive utilities.
  • Provides a ChatController for imperative actions like scrolling to the bottom.

Weaknesses

  • Requires a recent Flutter version (3.41.0 or later).
  • Limited documentation outside of provided markdown files and example apps.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
7

not documented

import 'package:flutter/material.dart';
import 'package:swifty_chat/swifty_chat.dart';

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

class AppUser extends ChatUser {
  AppUser(String name) : super(userName: name);
}

class AppMessage extends Message {
  const AppMessage({
    required super.user,
    required super.id,
    required super.isMe,
    required super.messageKind,
    required super.date,
  });
}

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

  @override
  State<ChatExample> createState() => _ChatExampleState();
}

class _ChatExampleState extends State<ChatExample> {
  final _messages = <Message>[];
  final _controller = ChatController();
  final _me = AppUser('You');

  @override
  Widget build(BuildContext context) => Scaffold(
    body: Chat(
      controller: _controller,
      messages: _messages,
      chatMessageInputField: MessageInputField(
        sendButtonTapped: (text) {
          final now = DateTime.now();
          setState(
            () => _messages.insert(
              0,
              AppMessage(
                user: _me,
                id: now.microsecondsSinceEpoch.toString(),
                isMe: true,
                messageKind: MessageKind.text(text),
                date: now,
              ),
            ),
          );
          _controller.scrollToBottom();
        },
      ),
    ),
  );
}

Alternatives

Packages that do the same job and could replace swifty_chat.

Works with

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