loadPinnedMessages method

Future<List<ChatMessage>> loadPinnedMessages()

Get the pinned messages in the conversation

Throws A description of the exception. See ChatError.

Implementation

Future<List<ChatMessage>> loadPinnedMessages() async {
  Map req = this._toJson();
  Map result = await _emConversationChannel.invokeMethod(
    ChatMethodKeys.pinnedMessages,
    req,
  );
  try {
    ChatError.hasErrorFromResult(result);
    List<ChatMessage> msgList = [];
    result[ChatMethodKeys.pinnedMessages]?.forEach((element) {
      msgList.add(ChatMessage.fromJson(element));
    });
    return msgList;
  } on ChatError catch (e) {
    throw e;
  }
}