getUnreadMessageCount method

Future<int> getUnreadMessageCount()

~english Gets the count of the unread messages.

Return The count of the unread messages.

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

~chinese 获取未读消息数。

Return 未读消息数。

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

Implementation

Future<int> getUnreadMessageCount() async {
  Map result =
      await ChatChannel.invokeMethod(ChatMethodKeys.getUnreadMessageCount);
  try {
    int ret = 0;
    ChatError.hasErrorFromResult(result);
    if (result.containsKey(ChatMethodKeys.getUnreadMessageCount)) {
      ret = result[ChatMethodKeys.getUnreadMessageCount] as int;
    }
    return ret;
  } on ChatError catch (e) {
    throw e;
  }
}