setAvatar method

Future<String> setAvatar(
  1. SDNFile? file
)

Uploads a new user avatar for this room. Returns the event ID of the new m.room.avatar event. Leave empty to remove the current avatar.

Implementation

Future<String> setAvatar(SDNFile? file) async {
  final uploadResp = file == null
      ? null
      : await client.uploadContent(file.bytes, filename: file.name);
  return await client.setRoomStateWithKey(
    id,
    EventTypes.RoomAvatar,
    '',
    {
      if (uploadResp != null) 'url': uploadResp.toString(),
    },
  );
}