Chat / Flutter
Current version: v3
Chat Flutter v3
Chat Flutter
Chat
Flutter
Home
/
Chat
/
Flutter
/
User

Retrieve a list of users in a channel

You can retrieve a list of participants who are currently online and receiving all messages from an open channel using the UserListQuery method.

Open channel

try {
    final listQuery = UserListQuery()
        ..queryType = UserListQueryType.participants;
    final participants = await listQuery.loadNext();
} catch (e) {
    // Handle error.
}

Group channel

You can retrieve a list of members in a group channel using the members property of a groupChannel object. Members of a group channel are automatically updated when a user is online. But when a user is disconnected from the Sendbird server and then reconnected, you should call the refresh() method to update their channels with the latest information. See the refresh all data related to a group channel section for the sample code.

final members = groupChannel.members;