/ SDKs / Flutter
SDKs
Chat SDKs Flutter v3
Chat SDKs Flutter
Chat SDKs
Flutter
Version 3
Sendbird Chat SDK v3 for Flutter is no longer supported as a new version is released. Check out our latest Chat SDK v4

Block and unblock other members

Copy link

A user can block another user if the user doesn't wish to receive any messages or notifications from the blocked user in a 1-to-1 group channel. In a 1-to-N group channel, the user may receive messages from the blocked user, depending on the UI settings of the chat view. In any case, notifications from the blocked user won't be delivered to the 1-to-N group channel. You can choose whether or not to allow the user to view which users are blocked in the channel UI.


Block modes

Copy link

Sendbird application provides two blocking options: including or excluding blocked users when sending invitations, and turning on or off notifications from blocked users. Explicit and classic block modes have been deprecated and are only supported for customers who started using them before they were deprecated.

  • Including or excluding blocked users when sending invitations: Determines whether or not to automatically filter out blocked users when a user invites a group of users to a new group channel. By default, blocked users are included when sending invitations. The value of this option can be changed by Sendbird if your Sendbird application isn't integrated to the client app. If you want to change the value, contact our sales team.

  • Turning on or off notifications from blocked users: Determines whether or not to receive message notifications from the blocked user in a specific 1-to-N group channel where they are both members. By default, a user doesn't receive notifications from blocked users. The value of this option can be set to individual channels. If you want to use this option, contact our sales team.

The following tables explain what happens to a user's chat experience when the user blocks another user in a 1-to-1 or 1-to-N group channel. In the case of a 1-to-1 group channel, the block mode is only maintained with the original members. If users other than the original members are added, the rules for a 1-to-N group channel begin to apply.

Results by channel type

Copy link
Channel typeChannel listNotificationsMessages

1-to-1 group channel

A user's channel list isn't updated in response to the blocked user's messages.

A user can't receive notifications for the messages from the blocked user.

A user can only see the messages that the blocked user has sent before being blocked. Even though messages sent from the blocked user aren't delivered to the channel, they are saved in the database and only displayed in the blocked user's channel view. This means that the blocked user isn't aware of their blocked status.

* If the blocked user is unblocked, a user can see all the messages from the blocked user except those that were sent during the blocking period.

1-to-N group channel

A user's channel list is updated in response to a blocked user's message.

By default, a user can't receive message notifications from a blocked user. If the option is turned on, the user can receive message notifications from the blocked user.

All messages from blocked users are delivered to the channel. You can choose whether or not a user can view the messages from the blocked users in the channel UI.


How to use block modes

Copy link

You can let users block and unblock other users by implementing the following code in your client app.

// Block a user.
try {
    final blockedUser = await sendbird.blockUser(USER_ID);
} catch (e) {
    // Handle error.
}

// Unblock a user.
try {
    final user = await sendbird.unblockUser(USER_ID);
    // The user is successfully unblocked.
} catch (e) {
    // Handle error.
}