License.parse constructor

License.parse(
  1. XmlElement element
)

Factory method to create a new License instance from an XML element.

The factory constructor takes an XmlElement representing the "license" element and extracts its attributes "type", "href", and "url", as well as the inner text. It uses these values to initialize the properties of the License object.

Implementation

factory License.parse(XmlElement element) {
  return License(
    type: element
        .getAttribute('type'), // Get the value of the "type" attribute.
    href: element
        .getAttribute('href'), // Get the value of the "href" attribute.
    url: element.getAttribute('url'), // Get the value of the "url" attribute.
    value: element.innerText, // Get the inner text of the "license" element.
  );
}