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 EMError. ~end

~chinese 获取未读消息数。

Return 未读消息数。

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

Implementation

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