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
-
- Object
- ChatBackend
- SupabaseChatBackend
Constructors
- SupabaseChatBackend({required String bucketName, SupabaseClient? client})
-
Creates a SupabaseChatBackend using
client, orSupabase.instance.clientif omitted (requiresSupabase.initializeto have already run), storing image attachments inbucketName.
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
messagefor the conversation atpath.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
filePathas a chat image attachment and returns its public URL.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited