Chat
Install Dependency
Package: meeting_place_chat
dart pub add meeting_place_chatCheck the latest version on the pub.dev registry or view the source on GitHub.
Classes and Methods
MeetingPlaceChatSDK
The MeetingPlaceChatSDK is a high-level API for secure messaging in the Meeting Place ecosystem. It supports individual DIDComm channels only. Group channels are not supported by this package — use the Matrix SDK for group messaging. Built on top of the core Meeting Place SDK, it uses Decentralised Identifiers (DID) and the DIDComm v2.1 protocol to ensure private, end-to-end encrypted communication.
initialiseChatFromChannel
A static method that creates an instance of MeetingPlaceChatSDK for the provided channel.
Parameters
channel
Channel
RequiredcoreSDK
MeetingPlaceCoreSDK
RequiredchatRepository
ChatRepository
Requiredoptions
MeetingPlaceChatSDKOptions
Requiredcard
ContactCard
Optionallogger
MeetingPlaceChatSDKLogger
OptionalExample
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
// Create a channel instance — only ChannelType.individual is supported.
final Channel channel = Channel(
type: ChannelType.individual,
permanentChannelDid: 'did:example:123',
otherPartyPermanentChannelDid: 'did:example:456',
mediatorDid: 'did:example:mediator',
offerLink: 'offer-link-value',
// ...other required fields
);
final chatSDK = await MeetingPlaceChatSDK.initialiseChatFromChannel(
channel,
coreSDK: coreSDK,
chatRepository: await ref.read(chatItemsRepositoryDriftProvider.future),
options: MeetingPlaceChatSDKOptions(presenceExpiresInSeconds: 3),
card: identityContactCard,
);startChatSession
Starts a new chat session.
- Initializes ChatStreamManager.
- Subscribes to the mediator channel.
- Loads persisted messages from repository.
- Triggers a profile hash sync.
Parameters
No parameters required.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
final chatSDK = await MeetingPlaceChatSDK.initialiseChatFromChannel(
...
);
final startSession = await chatSDK.startChatSession();endChatSession
Ends the chat session, disposing of the channel and stream manager.
Parameters
No parameters required.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
chatSDK.endChatSession();getMessageById
Retrieves a single message by ID.
Parameters
messageId
String
RequiredExample
import 'package:meeting_place_chat/meeting_place_chat.dart';
final messageId = '<MESSAGE-ID>';
final ChatItem? message = await chatSDK.getMessageById(messageId);sendChatContactDetailsUpdate
Sends updated contact details from the current contact card.
Parameters
message
ConciergeMessage
RequiredExample
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
final ConciergeMessage updateMessage = ConciergeMessage(
chatId: '<CHAT-ID>',
messageId: '<MESSAGE-ID>',
senderDid: '<YOUR-DID>',
isFromMe: true,
// ...other required fields
);
await chatSDK.sendChatContactDetailsUpdate(updateMessage);sendTextMessage
Sends a plain text message (optionally with attachments).
Parameters
text
String
Requiredattachments
List<ChatAttachment>
OptionalExample
import 'package:meeting_place_chat/meeting_place_chat.dart';
final Message sentMessage = await chatSDK.sendTextMessage(
'Hello, this is a test message!',
);reactOnMessage
Reacts (or unreacts) to a chat message with an emoji or symbol.
Parameters
message
Message
Requiredreaction
String
RequiredExample
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
await chatSDK.reactOnMessage(message, reaction: reaction);sendChatActivity
Sends a chat activity message.
Parameters
No parameters required.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
await chatSDK.sendChatActivity();sendChatPresence
Sends a “chat presence” signal (e.g., online status).
Parameters
No parameters required.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
await chatSDK.sendChatPresence();sendEffect
Sends a special chat effect.
Parameters
effect
Effect
Requiredconfetti, balloons, fireworks, hearts.Example
import 'package:meeting_place_chat/meeting_place_chat.dart';
// Send confetti effect
await chatSDK.sendEffect(Effect.confetti);sendChatDeliveredMessage
Sends a “delivered” acknowledgement for a received message.
Parameters
messageId
String
RequiredExample
import 'package:meeting_place_chat/meeting_place_chat.dart';
// Send a "delivered" receipt using the message ID.
await chatSDK.sendChatDeliveredMessage('<MESSAGE-ID>');approveConnectionRequest
Approves an incoming connection request.
Parameters
message
ConciergeMessage
RequiredExample
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
await chatSDK.approveConnectionRequest(message);rejectConnectionRequest
A special type of ChatItem used to represent system or administrative messages that require user action.
Parameters
message
ConciergeMessage
RequiredExample
import 'package:meeting_place_chat/meeting_place_chat.dart';
await chatSDK.rejectConnectionRequest(message);rejectChatContactDetailsUpdate
Rejects a contact details update and marks message as confirmed.
Parameters
message
ConciergeMessage
RequiredExample
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
await chatSDK.rejectChatContactDetailsUpdate(message);messages
Retrieves all persisted messages for this chat.
Parameters
No parameters required.
Example
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:meeting_place_chat/meeting_place_chat.dart';
final List<ChatItem> chatItems = await chatSDK.messages;chatStreamSubscription
Waits until the mediator channel subscription is ready. Stream of live chat events ([StreamData]) for this session.
Parameters
No parameters required.
Example
import 'package:meeting_place_chat/meeting_place_chat.dart';
final ChatStream? chatStream = await chatSDK.chatStreamSubscription;Glad to hear it! Please tell us how we can improve more.
Sorry to hear that. Please tell us how we can improve.
Thank you for sharing your feedback so we can improve your experience.