/ SDKs / Flutter
SDKs
Chat SDKs Flutter v4
Chat SDKs Flutter
Chat SDKs
Flutter
Version 4

Retrieve a list of blocked users

Copy link

You can retrieve a list of all or specific blocked users in your Sendbird application. The next() method of BlockedUserListQuery returns a list of User objects that contain information on the blocked users.

// Retrieve all blocked users.
final query = BlockedUserListQuery();

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

With the userIdsFilter filter of BlockedUserListQuery(), you can retrieve a list of the blocked users with the specified user IDs.

// Retrieve certain blocked users using the userIds filter.
final query = BlockedUserListQuery()
  ..userIdsFilter = ['John', 'Daniel', 'Jeff'];

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