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

Search open channels by name, URL, or custom type

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