getAllMessageCount method

Future<int> getAllMessageCount()

~english Get the message count from db.

Returns The message count in db.

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

~chinese 获取数据库中的消息总数。

Return 数据库中的消息总数。

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

Implementation

Future<int> getAllMessageCount() async {
  try {
    Map result = await Client.instance.chatManager
        .callNativeMethod(ChatMethodKeys.getMessageCount);
    EMError.hasErrorFromResult(result);
    if (result.containsKey(ChatMethodKeys.getMessageCount)) {
      return result[ChatMethodKeys.getMessageCount];
    } else {
      return 0;
    }
  } catch (e) {
    rethrow;
  }
}