toJson method

  1. @override
Map<String, dynamic> toJson()
override

Implementation

@override
Map<String, dynamic> toJson() {
  return {
    ...super.toJson(),
    'type': ComponentType.channelSelectMenu.value,
    'custom_id': _customId,
    'channel_types': _channelTypes.isNotEmpty
        ? _channelTypes.map((e) => e.value).toList()
        : null,
    'default_values': _defaultChannels.isNotEmpty
        ? _defaultChannels
            .map((e) => {'id': e.value, 'type': 'channel'})
            .toList()
        : null,
  };
}