Locked.parse constructor

Locked.parse(
  1. XmlElement element
)

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

The element is an XML element containing the locked status information.

Returns the parsed Locked object.

Implementation

factory Locked.parse(XmlElement element) {
  bool? valueBool;
  switch (element.innerText.toLowerCase()) {
    case 'yes':
      valueBool = true;
      break;
    case 'no':
      valueBool = false;
      break;
    default:
      valueBool = null;
      break;
  }
  return Locked(
    owner: element.getAttribute('owner'),
    value: valueBool,
  );
}