getFieldExtended<V> method

V? getFieldExtended<V>(
  1. String? fieldName, [
  2. V? def
])

Implementation

V? getFieldExtended<V>(String? fieldName, [V? def]) {
  if (fieldName == null) return def;
  var fieldComponent = getFieldComponent(fieldName);
  if (fieldComponent == null) return def;

  if (fieldComponent is UIField) {
    return fieldComponent.getFieldValue() as V? ?? def;
  } else if (fieldComponent is UIComponent) {
    var val = parseChildElementValue(fieldComponent.content,
        childUiComponent: fieldComponent);
    return val as V? ?? def;
  } else if (fieldComponent is UIElement) {
    var val = parseChildElementValue(fieldComponent);
    return val as V? ?? def;
  } else {
    return fieldComponent.toString() as V? ?? def;
  }
}