getNullableChildProperty<TFormElement> method
Property<TFormElement?>
getNullableChildProperty<TFormElement>({
- required String propertyName,
- required ElementParserFunction parser,
- required FormElement parent,
- required TFormElement? defaultValue(),
- bool isContentProperty = false,
- bool isImmutable = true,
override
Implementation
@override
Property<TFormElement?> getNullableChildProperty<TFormElement>({
required String propertyName,
required ElementParserFunction parser,
required FormElement parent,
required TFormElement? Function() defaultValue,
bool isContentProperty = false,
bool isImmutable = true,
}) {
var propertyElement = getPropertyAsElement(element, propertyName);
if (propertyElement == null && isContentProperty) {
propertyElement = element;
}
if (propertyElement != null) {
var childElement = propertyElement.children
.firstWhereOrNull((c) => c is XmlElement) as XmlElement?;
if (childElement != null) {
return createNullableProperty<TFormElement>(
parser(XmlParserNode(childElement), parent) as TFormElement,
isImmutable);
}
}
return createNullableProperty(defaultValue(), isImmutable);
}