UserAvatarMetadata.fromXML constructor

UserAvatarMetadata.fromXML(
  1. XMLNode node
)

Implementation

factory UserAvatarMetadata.fromXML(XMLNode node) {
  assert(node.tag == 'info', 'node must be an <info /> element');

  final width = node.attributes['width'] as String?;
  final height = node.attributes['height'] as String?;
  return UserAvatarMetadata(
    node.attributes['id']! as String,
    int.parse(node.attributes['bytes']! as String),
    width != null ? int.parse(width) : null,
    height != null ? int.parse(height) : null,
    node.attributes['type']! as String,
    node.attributes['url'] as String?,
  );
}