unreadCount method

Future<int> unreadCount()

Gets the unread message count of the conversation.

Return The unread message count of the conversation.

Throws A description of the exception. See ChatError.

Implementation

Future<int> unreadCount() async {
  Map req = this._toJson();
  Map result = await _emConversationChannel.invokeMethod(
      ChatMethodKeys.getUnreadMsgCount, req);
  try {
    ChatError.hasErrorFromResult(result);
    if (result.containsKey(ChatMethodKeys.getUnreadMsgCount)) {
      return result[ChatMethodKeys.getUnreadMsgCount];
    } else {
      return 0;
    }
  } on ChatError catch (e) {
    throw e;
  }
}