unreadCount method

Future<int> unreadCount()

获取会话的消息未读数。

Return 会话的消息未读数量。

Throws 如果有异常会在此抛出,包含错误码和原因,详见 ChatError

Implementation

Future<int> unreadCount() async {
  try {
    Map req = _toJson();
    Map result = await platform_interface.Client.instance.conversationManager
        .callNativeMethod(ChatMethodKeys.getUnreadMsgCount, req);
    ChatError.hasErrorFromResult(result);
    if (result.containsKey(ChatMethodKeys.getUnreadMsgCount)) {
      return result[ChatMethodKeys.getUnreadMsgCount];
    } else {
      return 0;
    }
  } catch (e) {
    rethrow;
  }
}