pinConversation method

Future<void> pinConversation({
  1. required String conversationId,
  2. required bool isPinned,
})

~english Sets whether to pin a conversation.

Param conversationId The conversation ID.

Param isPinned Whether to pin a conversation:

  • true: Pin the conversation.
  • false: Unpin the conversation.

Throws A description of the exception. See ChatError. ~end

~chinese 设置是否置顶会话。

Param conversationId 会话 ID。

Param isPinned 是否置顶会话:

  • true: 置顶会话。
  • false: 取消置顶会话。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end

Implementation

Future<void> pinConversation(
    {required String conversationId, required bool isPinned}) async {
  Map map = {
    'convId': conversationId,
    'isPinned': isPinned,
  };

  Map result = await ChatChannel.invokeMethod(
    ChatMethodKeys.pinConversation,
    map,
  );
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}