Chat / Flutter
Chat Flutter v3
Chat Flutter
Chat
Flutter
Version 3
Home
/
Chat
/
Flutter
/
Channel

Categorize channels by custom type

When creating an open channel or a group channel, you can additionally specify a custom channel type to subclassify channels. This custom type takes on the form of String, and can be useful in searching or filtering channels.

The data and customType properties of a channel object allow you to append information to channels. While both properties can be used flexibly, common examples for customType include categorizing channels as "School" or "Work".


Open channel

To get an open channel's custom type, refer to openChannel.customType.

try {
    final params = OpenChannelParams()
        ..customType = CUSTOM_TYPE
        ..name = NAME;

    final channel = OpenChannel.createChannel(params);
} catch (e) {
    // Handle error.
}

OpenChannelParams

Property nameTypeDescription

customType

String

Specifies the custom channel type which is used for channel grouping.

name

String

Specifies the name of the channel.


Group chnanel

To get a group channel's custom type, refer to groupChannel.customType.

final params = GroupChannelParams()
    ..userIds = ['Jed', 'Young']
    ..name = NAME
    ..customType = CUSTOM_TYPE;

try {
    final channel = await GroupChannel.createChannel(params);
} catch (e) {
    // Handle error.
}

GroupChannelParams

Property nameTypeDescription

customType

String

Specifies the custom channel type which is used for channel grouping.

name

String

Specifies the name of the channel.

userIds

String

Specifies the list of users.