SupabaseChatBackend class

A ChatBackend backed by a Supabase Postgres table (message storage and realtime subscriptions) and Supabase Storage (image uploads).

Each conversation's path (see ChatEntity.path) is used as the Supabase table name; every row is one message, with an id (uuid, default gen_random_uuid()) primary key and a timestamp timestamptz column (default now()). Realtime must be enabled for the table.

Inheritance

Constructors

SupabaseChatBackend({required String bucketName, SupabaseClient? client})
Creates a SupabaseChatBackend using client, or Supabase.instance.client if omitted (requires Supabase.initialize to have already run), storing image attachments in bucketName.

Properties

bucketName String
The Supabase Storage bucket used for image attachments.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose(String path) → void
Releases any resources (subscriptions, clients) held for path.
override
fetchMessages(String path) Future<List<ChatBackendMessage>>
Fetches all existing messages for the conversation at path, ordered oldest first.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendMessage(String path, ChatMessage message) Future<void>
Persists message for the conversation at path.
override
subscribeToNewMessages(String path) Stream<ChatBackendMessage>
Subscribes to newly created messages for the conversation at path.
override
toString() String
A string representation of this object.
inherited
uploadImage(String filePath, String fileName) Future<String>
Uploads filePath as a chat image attachment and returns its public URL.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited