/ 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

Search open channels by name, URL, or custom type

Copy link

You can search for specific open channels by adding keywords to an OpenChannelListQuery instance. There are two types of keywords that can be used: name and URL.

The code sample below shows the query instance which returns a list of open channels that partially match the specified channelName keyword in their channel names.

try {
    final listQuery = OpenChannelListQuery()
        ..channelName = 'Sendbird';

    final channels = await listQuery.loadNext();
    // A list of open channel names that partially match 'Sendbird' is returned.
} catch (e) {
    // Handle error.
}

The following shows the query instance which returns a list of open channels that partially match the specified channelUrl keyword in their channel URLs.

try {
    final listQuery = OpenChannelListQuery()
        ..channelUrl = 'seminar';

    final channels = await listQuery.loadNext();
    // A list of open channel URLs that partially match 'seminar' is returned.
} catch (e) {
    // Handle error.
}

You can also search for open channels with a specific custom type by setting customType as in the following code.

try {
    let listQuery = OpenChannelListQuery()
        ..customType = 'movie';

    final channels = await listQuery.loadNext();
    // A list of open channels with the custom type movie is returned.
} catch (e) {
    // Handle error.
}