Set DND by channel
Set DND level for a channel
Set the DND level for a specific channel by calling channel.setNoDisturbLevel(). Supports direct, group, and community channels.
Method
Dart
Future<int> setNoDisturbLevel(NoDisturbLevel level, ErrorHandler handler)
Parameters
| Parameter | Type | Description |
|---|---|---|
level | NoDisturbLevel | DND level. See DND overview. |
handler | ErrorHandler | Event callback. |
Code example
Dart
final channel = DirectChannel('<target-user-id>');
await channel.setNoDisturbLevel(
NoDisturbLevel.blocked,
(error) {
if (error == null) {
print('DND level set');
}
},
);
Get DND level for a channel
Use channel.reload() to refresh channel data, then read channel.notificationLevel.
Get DND channel list
Use BaseChannel.getChannels() and filter by notificationLevel.