name property

String? name

Shortcut to get channel name.

If an name is provided it will be set on extraData with a key of 'name'.

For example:

final user = User(id: 'id', name: 'Sahil Kumar');
print(user.name == user.extraData['name']); // true

Implementation

String? get name => extraData['name'] as String?;
void name=(String? name)

Shortcut to set channel name.

If an name is provided it will be set on extraData with a key of 'name'.

For example:

final user = User(id: 'id', name: 'Sahil Kumar');
print(user.name == user.extraData['name']); // true

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});
}