Bucket.fromXml constructor

Bucket.fromXml(
  1. XmlElement xml
)

Implementation

factory Bucket.fromXml(XmlElement xml) {
  final creationDateString = getProp(xml, 'CreationDate')?.value;
  final name = getProp(xml, 'Name')?.value;

  if (creationDateString == null || name == null) {
    throw Exception('Missing required XML properties');
  }

  return Bucket(
    DateTime.parse(creationDateString),
    name,
  );
}