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

Categorize channels by custom type

Copy link

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 when 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

Copy link

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

try {
  final params = OpenChannelCreateParams()
    ..name = 'NAME'
    ..customType = 'CUSTOM_TYPE';
    
  final openChannel = OpenChannel.createChannel(params);
} catch (e) {
  // Handle error.
}

OpenChannelParams

Copy link
Property nameTypeDescription

name

String

Specifies the name of the channel.

customType

String

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


Group chnanel

Copy link

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

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

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

GroupChannelParams

Copy link
Property nameTypeDescription

name

String

Specifies the name of the channel.

customType

String

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

userIds

String

Specifies the list of users.