Muting Channels

Muting a channel prevents it from triggering push notifications, unhiding, or incrementing the unread count for that user.

By default, mutes remain active indefinitely until removed. You can optionally set an expiration time. The list of muted channels and their expiration times is returned when the user connects.

Mute a Channel

// mute channel for current user await channel.mute();  // mute a channel for 2 weeks await channel.mute(expiration: Duration(days: 15));  // mute a channel for 10 seconds await channel.mute(expiration: Duration(seconds: 10));  // check if channel is muted channel.isMuted;

Messages added to muted channels do not increase the unread messages count.

Query Muted Channels

Muted channels can be filtered or excluded by using the muted in your query channels filter.

// retrieve all channels excluding muted ones await client.queryChannels(  filter: {  'members': {  r'$in': [userId],  },  'muted': false,  }  );  // retrieve all muted channels await client.queryChannels(  filter: {  'muted': true,  }  );

Remove a Channel Mute

Use the unmute method to restore normal notifications and unread behavior for a channel.

// unmute channel for current user await channel.unmute();  // unmute channel for a user (server-side) await channel.unmute({ user_id: userId });