Skip to content

Channel filtration on unreadChannelsStream #2513

@safwanidrees

Description

@safwanidrees

Please select which package this feature is related to

stream_chat_flutter

Which platforms would this feature impact?

iOS, Android, Web

Is your feature request related to a problem?

No response

Describe the solution that you'd like

No response

Describe alternatives that you have considered

final subscription = client.state.unreadChannelsStream.listen((event) { unreadCount.value = event; });

This stream returns unread counts for all channels, but we only want to listen to specific channels. In the main chat list, we already use a controller with filters. We need to apply similar filtering to the unread count stream so that we receive unread counts only for those specific channels.

final controller = StreamChannelListController( client: client, filter: Filter.or([ Filter.and([ Filter.in_('members', [currentUser!.id]), Filter.notExists('event_type'), Filter.exists('last_message_at'), ]), Filter.and([ Filter.in_('members', [currentUser.id]), Filter.notExists('event_type'), Filter.equal('hidden', true), ]), ]), channelStateSort: const [SortOption('last_message_at')], limit: 20, );

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions