pinConversation static method
- String conversationWith,
- String conversationType, {
- dynamic onSuccess(
- Conversation conversation
- dynamic onError(
- CometChatException excep
Pin the logged-in user's conversation with a user or group so it surfaces at the top of the conversations list.
conversationWith is the counterpart uid/guid, conversationType
user/group. Returns the full updated Conversation with
pinnedAt/pinnedBy stamped. Idempotent.
A conversation can also be pinned by an admin surface, in which case
pinnedBy carries the app_system sentinel and the pin cannot be
removed from the client.
This device fires ConversationListener.onConversationPinned once for
its own call, before onSuccess. The server self-echoes a socket frame,
which the armed marker drops so the listener still fires exactly once;
the user's other devices also receive it, as they do an admin pin. 5.1.0
keeps the 5.0.9 same-device callback for UI Kit compatibility; see
BEH-FLAG-04.
Implementation
static Future<Conversation?> pinConversation(
String conversationWith,
String conversationType, {
Function(Conversation conversation)? onSuccess,
Function(CometChatException e)? onError,
}) {
return _conversationPinFacadeCall(
conversationWith,
conversationType,
'conversation_pinned',
(sdk) =>
sdk.conversations.pinConversation(conversationWith, conversationType),
onSuccess,
onError,
);
}