FirestackMessaging class

Instant messaging service for Firestack.

Provides channel management, message CRUD, reactions, read receipts, typing indicators, and member management.

final messaging = app.messaging;

// List channels
final channels = await messaging.channels(projectId: 1);

// Create a group channel
final channel = await messaging.createChannel(
  projectId: 1,
  name: 'general',
  memberIds: [2, 3],
);

// Send a message
final msg = await messaging.sendMessage(
  channelId: channel.id,
  body: 'Hello world!',
);

// React to a message
await messaging.addReaction(messageId: msg.id, emoji: '👍');

// Mark channel as read
await messaging.markAsRead(channelId: channel.id);

Constructors

FirestackMessaging({required FirestackClient client})

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

addMember(String channelId, {required int userId, String role = 'member'}) Future<void>
Add a member to a channel.
addReaction({required String messageId, required String emoji}) Future<void>
Add an emoji reaction to a message.
channels({required int projectId, int perPage = 20, int page = 1}) Future<PaginatedResult<FirestackChannel>>
List channels the authenticated user belongs to.
createChannel({required int projectId, required String name, String? description, String type = 'group', bool isPrivate = false, Map<String, dynamic>? metadata, List<int>? memberIds}) Future<FirestackChannel>
Create a group or project channel.
createDirectChannel({required int projectId, required int userId}) Future<FirestackChannel>
Create or retrieve a direct message channel with another user.
deleteChannel(String channelId) Future<void>
Delete a channel.
deleteMessage(String messageId) Future<void>
Delete a message.
getChannel(String channelId) Future<FirestackChannel>
Get a single channel by UUID.
getMembers(String channelId) Future<List<Map<String, dynamic>>>
List members of a channel.
markAsRead(String channelId) Future<int>
Mark all messages in a channel as read for the authenticated user.
messages(String channelId, {int perPage = 50, int? beforeId, int page = 1}) Future<PaginatedResult<FirestackMessage>>
List messages in a channel (newest first).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeMember(String channelId, {required int userId}) Future<void>
Remove a member from a channel.
removeReaction({required String messageId, required String emoji}) Future<void>
Remove an emoji reaction from a message.
searchMessages(String channelId, {required String query, int perPage = 20, int page = 1}) Future<PaginatedResult<FirestackMessage>>
Search messages in a channel.
sendMessage({required String channelId, required String body, String type = 'text', Map<String, dynamic>? metadata, int? replyToId}) Future<FirestackMessage>
Send a message to a channel.
sendTyping(String channelId, {bool isTyping = true}) Future<void>
Send a typing indicator to a channel.
toggleMute(String channelId) Future<bool>
Toggle mute on a channel for the authenticated user.
togglePin(String channelId) Future<bool>
Toggle pin on a channel for the authenticated user.
toString() String
A string representation of this object.
inherited
updateChannel(String channelId, {String? name, String? description, String? avatar, bool? isArchived, Map<String, dynamic>? metadata}) Future<FirestackChannel>
Update a channel.
updateMemberRole(String channelId, {required int userId, required String role}) Future<void>
Update a member's role.
updateMessage(String messageId, {required String body, Map<String, dynamic>? metadata}) Future<FirestackMessage>
Edit a message.

Operators

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