getUnreadMessageCount method

Future<int> getUnreadMessageCount()

获取未读消息数。

Return 未读消息数。

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

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;
  }
}