Field.fromMap constructor

Field.fromMap(
  1. Map<String, dynamic> map
)

Optionally, you can add a factory method to construct a Field from a Map.

Implementation

factory Field.fromMap(Map<String, dynamic> map) {
  return Field(
    fieldStyle: map['fieldStyle'],
    name: map['name'],
    dataType: map['dataType'],
    label: map['label'],
    placeholder: map['placeholder'],
    formatter: map['formatter'],
    fieldType: map['fieldType'],
    hidden: map['hidden'],
    defaultValue: map['defaultValue'],
    disabledOn: map['disabledOn'] != null
        ? ConditionalOn.fromMap(map['disabledOn'])
        : null,
    disabled: map['disabled'],
    dependentOn: map['dependentOn'] != null
        ? List<String>.from(map['dependentOn'])
        : null,
    validation: map['validation'] != null
        ? Validation.fromMap(map['validation'])
        : null,
    autoFill: map['autoFill'] != null
        ? List<AutoFill>.from(
            map['autoFill']?.map((a) => AutoFill.fromMap(a)))
        : null,
    options: map['options'] != null
        ? List<Option>.from(map['options']?.map((o) => Option.fromMap(o)))
        : null,
    source: map['source'] != null ? Source.fromMap(map['source']) : null,
    conditionalOn: map['conditionalOn'] != null
        ? ConditionalOn.fromMap(map['conditionalOn'])
        : null,
  );
}