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