name property
String?
name
Shortcut to get channel 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
String? get name => extraData['name'] as String?;
Shortcut to set channel 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
set name(String? name) {
if (_initializedCompleter.isCompleted) {
throw StateError(
'Once the channel is initialized you should use `channel.updateName` '
'to update the channel name',
);
}
_extraData.addAll({'name': name});
}