name property

  1. @JsonKey(includeToJson: false, includeFromJson: false)
String name

Shortcut for user name.

If an optional name argument is provided in the constructor then it will be set on extraData with a key of 'name'.

final channel = Channel(client, type, id, name: 'Channel name');
print(channel.name == channel.extraData['name']); // true

Before the channel is initialized the name can be set directly:

channel.name = 'New channel name';

To update the name after the channel has been initialized, call:

channel.updateName('Updated channel name');

This will do a partial update to update the name.

Implementation

@JsonKey(includeToJson: false, includeFromJson: false)
String get name {
  if (extraData.containsKey('name') && extraData['name'] != null) {
    final name = extraData['name']! as String;
    if (name.isNotEmpty) return name;
  }
  return id;
}