supabase_chat 0.1.0 copy "supabase_chat: ^0.1.0" to clipboard
supabase_chat: ^0.1.0 copied to clipboard

A plug-and-play chat domain on top of supabase_realtime_kit: rooms, messages with optimistic send, typing indicators, presence, and read receipts.

example/README.md

supabase_chat example #

Create a room, send an optimistic message, and listen to the live timeline.

import 'package:supabase/supabase.dart';
import 'package:supabase_chat/supabase_chat.dart';

Future<void> main() async {
  final client = SupabaseClient('https://YOUR.supabase.co', 'YOUR_ANON_KEY');
  await client.auth.signInAnonymously();
  final chat = SupabaseChat(client);

  // A 1:1 direct room (created/looked up idempotently).
  final result = await chat.directRoom('the-other-user-id');
  final room = switch (result) {
    Ok(:final value) => value,
    Err(:final error) => throw error,
  };

  room.messages.listen((messages) {
    for (final m in messages) {
      print('${m.senderId}: ${m.content}${m.pending ? ' (sending…)' : ''}');
    }
  });
  await room.join();

  await room.send(text: 'hey 👋');           // optimistic
  await room.setTyping(typing: true);        // typing indicator
  await room.react(someMessageId, '👍');     // reaction
  await room.markRead();                     // read receipt

  await room.leave();
}
0
likes
160
points
91
downloads

Documentation

API reference

Publisher

verified publisherandroidpoet.dev

Weekly Downloads

A plug-and-play chat domain on top of supabase_realtime_kit: rooms, messages with optimistic send, typing indicators, presence, and read receipts.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

meta, supabase, supabase_realtime_kit

More

Packages that depend on supabase_chat