getChildrenProperty<TFormElement> method
Property<List<TFormElement> >
getChildrenProperty<TFormElement>({
- FormElement? parent,
- required String childrenPropertyName,
- ElementParserFunction? parser,
- bool isContentProperty = false,
- bool isImmutable = true,
override
Implementation
@override
Property<List<TFormElement>> getChildrenProperty<TFormElement>(
{FormElement? parent,
required String childrenPropertyName,
ElementParserFunction? parser,
bool isContentProperty = false,
bool isImmutable = true}) {
var childrenXmlElement =
getPropertyAsElement(element, childrenPropertyName);
if (childrenXmlElement != null) {
var children = childrenXmlElement.children
.whereType<XmlElement>()
.map((c) => parser!(XmlParserNode(c), parent))
.cast<TFormElement>()
.toList();
var childrenProperty = createProperty(children, isImmutable);
return childrenProperty;
}
if (childrenXmlElement == null && isContentProperty) {
var children = element.children
.where((c) =>
c is XmlElement &&
!c.name.qualified.startsWith(element.name.qualified + '.'))
.map((c) => parser!(XmlParserNode(c as XmlElement), parent))
.cast<TFormElement>()
.toList();
return createProperty(children, isImmutable);
}
return createProperty(<TFormElement>[], isImmutable);
}