Integrate Meeting Place for Dart
By the end of this guide, two SDK instances representing different users will have established a DIDComm channel and exchanged a text message.
The Meeting Place SDK handles DID generation, mediator transport, and the consent-gated connection flow. This guide covers individual (peer-to-peer) DIDComm messaging using meeting_place_core and meeting_place_chat. For Matrix group chat or audio and video calling, see the Matrix SDK reference.
If you want to explore the full feature set without writing code, run the Flutter reference app instead.
Prerequisites
- Dart SDK 3.11.0 or later.
- A running DIDComm Mediator. See Mediator deployment options. Note its DID value: you will use it as
<YOUR-MEDIATOR-DID>in the config. - A running Control Plane API. See Control Plane deployment options. Note its DID value: you will use it as
<YOUR-CONTROL-PLANE-DID>in the config.
Required packages
| Package | Purpose |
|---|---|
meeting_place_core | Connection setup, offer publishing, and DIDComm transport. |
meeting_place_chat | High-level messaging API built on Core SDK. |
ssi | Wallet and DID management. |
Install all three:
dart pub add meeting_place_core:^1.0.3 meeting_place_chat:^1.0.3 ssi:^3.9.4The Meeting Place packages need ssi 3.x, so pin it as shown rather than to its latest major version.
Storage
The SDK stores connection offers, groups, channels, keys, and chat items through repositories you provide. To get started, copy the in-memory implementations from the packages’ examples into your project:
- From
meeting_place_core:example/utils/storage.dartand the files inexample/utils/repository/. - From
meeting_place_chat:example/utils/repository/chat_repository_impl.dart.
In-memory storage loses everything when the app stops. For persistent storage, implement the same repository interfaces over your own database, or use the Drift-based repositories in meeting_place_drift_repository.
Integration walkthrough
The steps below follow a two-party flow: Alice publishes a connection offer and Bob claims it. Both parties end with an active DIDComm channel and a text message exchanged.
Initialise the Core SDK
Create one MeetingPlaceCoreSDK instance per user, with its own wallet and storage.
When connecting to the Affinidi-hosted Control Plane API, use
PersistentWalletwithp256keys.
import 'package:meeting_place_core/meeting_place_core.dart';
import 'package:ssi/ssi.dart';
import 'storage.dart';
import 'repository/channel_repository_impl.dart';
import 'repository/connection_group_offer_repository_impl.dart';
import 'repository/connection_offer_repository_impl.dart';
import 'repository/key_repository_impl.dart';
final aliceStorage = InMemoryStorage();
final aliceSDK = await MeetingPlaceCoreSDK.create(
wallet: PersistentWallet(InMemoryKeyStore()),
repositoryConfig: RepositoryConfig(
connectionOfferRepository: ConnectionOfferRepositoryImpl(storage: aliceStorage),
groupRepository: GroupRepositoryImpl(storage: aliceStorage),
channelRepository: ChannelRepositoryImpl(storage: aliceStorage),
keyRepository: KeyRepositoryImpl(storage: aliceStorage),
),
config: MeetingPlaceCoreConfig(
mediatorDid: '<YOUR-MEDIATOR-DID>',
controlPlaneDid: '<YOUR-CONTROL-PLANE-DID>',
),
);Register how the user receives notifications of new control plane events:
- Flutter mobile apps: register the device’s push token with
await aliceSDK.registerForPushNotifications('<DEVICE-TOKEN>');. - Dart services or tests: register a mediator inbox with
await aliceSDK.registerForDIDCommNotifications();, then subscribe to it as shown in the next step.
Repeat this setup for Bob with his own wallet and storage.
Publish a connection offer (Alice)
Alice publishes an offer so Bob can discover and request to connect with her. The SDK returns a mnemonic passphrase that Alice shares with Bob out-of-band: for example, as a QR code or deep link.
final publishOfferResult = await aliceSDK.publishOffer(
PublishOfferRequest(
offerName: 'Connect with Alice',
offerDescription: 'Alice\'s personal Meeting Place invitation.',
contactCard: ContactCard(
did: 'did:example:alice',
type: 'individual',
contactInfo: {'fn': 'Alice'},
),
type: SDKConnectionOfferType.invitation,
validUntil: DateTime.now().toUtc().add(const Duration(minutes: 5)),
),
);
// Share this mnemonic with Bob out-of-band (QR code, deep link, etc.).
final mnemonic = publishOfferResult.connectionOffer.mnemonic;Listen on controlPlaneEventsStream, and approve Bob’s connection request when the invitationAccept event arrives:
aliceSDK.controlPlaneEventsStream.listen((event) async {
if (event.type == ControlPlaneEventType.invitationAccept) {
await aliceSDK.approveConnectionRequest(
ApproveConnectionRequestParams(channel: event.channel),
);
}
});Call processControlPlaneEvents() each time a notification arrives: from your push notification handler on mobile, or from the mediator inbox in a Dart service:
final notification = await aliceSDK.registerForDIDCommNotifications();
final inbox = await notification.recipientDidManager.getDidDocument();
final notificationStream = await aliceSDK.subscribe(
DidCommSubscription(ownerDid: inbox.id),
);
notificationStream.stream.listen((message) async {
await aliceSDK.processControlPlaneEvents();
});Find the offer (Bob)
Bob looks up Alice’s offer using the mnemonic passphrase she shared.
final offerResult = await bobSDK.findOffer(mnemonic: mnemonic);Accept the offer (Bob)
Bob accepts the offer, attaching his contact card. The notification to Alice is sent automatically inside acceptOffer.
final offerAcceptedResult = await bobSDK.acceptOffer(
AcceptOfferRequest(
connectionOffer: offerResult.connectionOffer!,
contactCard: ContactCard(
did: 'did:example:bob',
type: 'individual',
contactInfo: {'fn': 'Bob'},
),
senderInfo: 'Bob',
),
);Listen for offerFinalised on Bob’s controlPlaneEventsStream. It fires once Alice approves and Bob’s event processing runs, and it carries the channel.
bobSDK.controlPlaneEventsStream.listen((event) async {
if (event.type == ControlPlaneEventType.offerFinalised) {
final channel = event.channel;
// The channel is established. Start the chat session in the next step.
}
});Bob triggers event processing from his notification handler, the same way Alice does.
Start a chat session (both parties)
With the channel established, create a MeetingPlaceChatSDK instance for each party and start the session.
import 'package:meeting_place_chat/meeting_place_chat.dart';
import 'repository/chat_repository_impl.dart';
// Alice's chat session. Bob mirrors this with his own channel and Core SDK.
final aliceChatSDK = MeetingPlaceChatSDK.initialiseChatFromChannel(
channel,
coreSDK: aliceSDK,
chatRepository: ChatRepositoryImpl(storage: aliceStorage),
options: MeetingPlaceChatSDKOptions(
chatPresenceSendInterval: const Duration(seconds: 60),
),
card: ContactCard(did: 'did:example:alice', type: 'individual', contactInfo: {'fn': 'Alice'}),
);
await aliceChatSDK.startChatSession();Send and receive messages (both parties)
With the session running, use sendTextMessage to send and chatStreamSubscription to receive.
// Bob sends a message.
await bobChatSDK.sendTextMessage('Hi Alice!');
// Alice listens for incoming messages.
final chatStream = await aliceChatSDK.chatStreamSubscription;
chatStream?.listen((data) {
if (data.event is ChatMessageEvent) {
print(data.chatItem?.toJson());
}
});To send raw DIDComm messages with a custom type, such as application-level commands, use the Core SDK’s sendMessage. See the Meeting Place SDK reference.
What’s next
Glad to hear it. Thanks for letting us know.
Sorry to hear that. Thanks for letting us know.
Still stuck? Ask the community on Discord or contact us.