/ 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

Retrieve a list of blocked users

Copy link

By setting the UserListQuery's queryType to blocked, you can retrieve a list of all or specific blocked users in your Sendbird application. The loadNext() method returns a list of User objects that contain information on the blocked users.

// Retrieve all blocked users.
final listQuery = UserListQuery()
..queryType = UserListQueryType.blocked;
        ..channelType=ChannelType.channel // Channel can be open or group.

try {
    final users = await listQuery.loadNext();
    // A list of blocked users is successfully retrieved.
} catch (e) {
    // Handle error.
}

With the userIds filter of the UserListQuery, you can retrieve a list of the blocked users with the specified user IDs.

// Retrieve certain blocked users using the userIds filter.
final listQuery = UserListQuery()
    ..queryType = UserListQueryType.blocked
    ..userIds = ['John', 'Daniel', 'Jeff'];

try {
    final users = await listQuery.loadNext();
    // A list of matching users is successfully retrieved.
} catch (e) {
    // Handle error.
}