ChatService class abstract
Abstract interface that defines all backend-side behavior for chat.
Concrete implementations can use Firestore, REST, Supabase, etc.
Example:
class MyChatService implements ChatService {
@override
Stream<List<ChatMessage>> watchMessages({
required String chatId,
int limit = 50,
String? startAfterMessageId,
}) {
// Your implementation
}
// ... implement other methods
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
blockUser(
{required String chatId, required String userId, required String blockedUserId}) → Future< bool> - Blocks a user.
-
deleteMessage(
{required String chatId, required String messageId}) → Future< bool> - Deletes a message (soft delete).
-
markAsRead(
{required String chatId, required String userId, required String lastReadMessageId, required DateTime lastReadAt}) → Future< void> - Marks messages as read.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendMessage(
{required String chatId, required String authorId, required String text, String? replyToMessageId}) → Future< ChatMessage> - Sends a new message.
-
toString(
) → String -
A string representation of this object.
inherited
-
unblockUser(
{required String chatId, required String userId, required String blockedUserId}) → Future< bool> - Unblocks a user.
-
watchBlockedUsers(
{required String chatId, required String userId}) → Stream< Set< String> > - Stream of blocked users.
-
watchMessages(
{required String chatId, int limit = 50, String? startAfterMessageId}) → Stream< List< ChatMessage> > - Paginated stream of messages for a chat.
-
watchUnreadCount(
{required String chatId, required String userId}) → Stream< int> - Stream of unread message count.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited