image property

String? image

Shortcut to get channel image.

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

final channel = Channel(client, type, id, image: 'https://getstream.io/image.png');
print(channel.image == channel.extraData['image']); // true

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

channel.image = 'https://getstream.io/new-image';

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

channel.updateImage('https://getstream.io/new-image');

This will do a partial update to update the image.

Implementation

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

Shortcut to set channel image.

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

final channel = Channel(client, type, id, image: 'https://getstream.io/image.png');
print(channel.image == channel.extraData['image']); // true

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

channel.image = 'https://getstream.io/new-image';

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

channel.updateImage('https://getstream.io/new-image');

This will do a partial update to update the image.

Implementation

set image(String? image) {
  if (_initializedCompleter.isCompleted) {
    throw StateError(
      'Once the channel is initialized you should use `channel.updateImage` '
      'to update the channel image',
    );
  }
  _extraData.addAll({'image': image});
}