LiveItem.parse constructor

LiveItem.parse(
  1. XmlElement element
)

Factory method to parse an XmlElement and create a LiveItem object from it.

The element is an XML element containing the live item information.

Returns the parsed LiveItem object.

Implementation

factory LiveItem.parse(XmlElement element) {
  final startStr = element.getAttribute('start');
  final endStr = element.getAttribute('end');
  return LiveItem(
    status: _parseLiveItemStatusType(element.getAttribute('status')),
    start: startStr == null ? null : DateTime.tryParse(startStr),
    end: endStr == null ? null : DateTime.tryParse(endStr),
    item: RssItem.parse(element),
  );
}