Chat / Flutter
Chat Flutter v3
Chat Flutter
Chat
Flutter
Version 3
Home
/
Chat
/
Flutter
/
User

Retrieve a list of blocked users

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.
}