getUnreadCount method

Future<GetUnreadCountResponse> getUnreadCount()

Returns the unread count information for the current user.

Implementation

Future<GetUnreadCountResponse> getUnreadCount() async {
  final response = await _chatApi.user.getUnreadCount();

  // Emit an local event with the unread count information as a side effect
  // in order to update the current user state.
  handleEvent(Event(
    totalUnreadCount: response.totalUnreadCount,
    unreadChannels: response.channels.length,
    unreadThreads: response.threads.length,
  ));

  return response;
}