getChildProperty<TFormElement> method

  1. @override
Property<TFormElement> getChildProperty<TFormElement>({
  1. required String propertyName,
  2. required ElementParserFunction parser,
  3. required FormElement parent,
  4. required TFormElement defaultValue(),
  5. bool isContentProperty = false,
  6. bool isImmutable = true,
})
override

Implementation

@override
Property<TFormElement> getChildProperty<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 createProperty<TFormElement>(
          parser(XmlParserNode(childElement), parent) as TFormElement,
          isImmutable);
    }
  }
  return createProperty(defaultValue(), isImmutable);
}