Chat

Built on top of the core Meeting Place SDK that utilises Decentralised Identifier (DID) and DIDComm Messaging v2.1 protocol to send secure and private messages with end-to-end encryption.

Install Dependency

Package: meeting_place_chat

dart pub add meeting_place_chat

Check 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 Required
The Channel entity representing the chat.
coreSDK MeetingPlaceCoreSDK Required
Instance of MeetingPlaceCoreSDK to retrieve group information if needed.
chatRepository ChatRepository Required
The ChatRepository used for persisting messages.
options MeetingPlaceChatSDKOptions Required
Configuration options for the chat.
card ContactCard Optional
Optional contact card representing the user profile.
logger MeetingPlaceChatSDKLogger Optional
Optional logger implementation for custom logging behaviour.

Example

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 Required
A unique message identifier.

Example

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 Required
Message of updated contact details.

Example

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 Required
The message content.
attachments List<ChatAttachment> Optional
An optional list of attachments.

Example

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 Required
The target message.
reaction String Required
The reaction string (e.g., emoji).

Example

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 Required
The effect to send. Possible values defined in enum are as follows: confetti, 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 Required
The unique identifier of the message to acknowledge.

Example

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 Required
A special type of ChatItem used to represent system or administrative messages that require user action.

Example

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 Required
The ConciergeMessage requesting approval.

Example

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 Required
The ConciergeMessage rejecting details update.

Example

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;