Pin or unpin a message
Use the Flutter SDK to pin or unpin a message in a conversation.
Pin a specific message to the top of a conversation, or unpin a previously pinned message:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | String | Yes | Target conversation ID. |
clientMsgID | String | Yes | Target client message ID to pin or unpin. |
pinned | bool | Yes | Pinning state: true to pin; false to unpin. |
Code example
await OpenIM.iMManager.messageManager.setConversationPinnedMsg(
conversationID: conversationID,
clientMsgID: clientMsgID,
pinned: true,
);Return value
Future completion indicates that the server accepted the pin or unpin request.
Future completion does not guarantee that event notifications have arrived at all clients. Update local conversation pin states optimistically if desired; to retrieve the complete current list of pinned messages, see Retrieve pinned conversation messages.
State changes after the call
Pinned message changes trigger the onChangedPinnedMsg callback in OnAdvancedMsgListener. When another client or an administrator updates pinned messages, participants in the conversation receive this callback. Locate the target conversation by conversationID and merge or replace the pinned message list deduplicating items by clientMsgID. For centralized listener registration, see Events overview.
Was this page helpful?