getProperty<T> method
Property<T>
getProperty<
T>( - String name,
- T converter(
- String s
),
- T defaultValue(), {
- bool isImmutable = true,
})
override
Implementation
@override
Property<T> getProperty<T>(
String name, T Function(String s) converter, T Function() defaultValue,
{bool isImmutable = true}) {
var property = getPropertyAsElement(element, name);
if (property != null) {
var firstChild = property.firstChild;
if (firstChild != null) {
if (firstChild is XmlText || firstChild is XmlCDATA) {
return createProperty<T>(converter(firstChild.text), isImmutable);
}
if (firstChild is XmlElement) {
if (firstChild.name.qualified == 'expression') {
var expressionChild = firstChild.firstChild!;
if (expressionChild.nodeType == XmlNodeType.CDATA ||
expressionChild.nodeType == XmlNodeType.TEXT) {
return StringExpressionProperty<T>(expressionChild.text);
}
}
}
}
}
var attributeValue = getAttribute(element, name);
if (attributeValue != null) {
return createProperty<T>(converter(attributeValue), isImmutable);
}
return createProperty<T>(defaultValue(), isImmutable);
}