InputField.fromJson constructor

InputField.fromJson(
  1. dynamic data
)

Implementation

factory InputField.fromJson(dynamic data) {
  var json = DynamicJsonExtension.getJsonMap(data);

  return InputField(
    type: InputFieldTypeExtension.fromJson(json['type']),
    name: json['name'],
    value: json['value'],
    label: json['label'],
    maxLength: json['max_length'],
    isRequired: json['is_required'],
    optionsList: (json['optionsList'] as List<dynamic>?)
        ?.map((item) => OptionItem.fromJson(item as Map<String, dynamic>))
        .toList(),
    optionsMap: (json['options'] as Map<String, dynamic>?)?.map(
      (key, value) => MapEntry(
        key,
        (value as List<dynamic>)
            .map((item) => OptionItem.fromJson(item as Map<String, dynamic>))
            .toList(),
      ),
    ),
    hint: json['hint'],
    minLength: json['min_length'],
    readOnly: json['read_only'],
    dependsOn: json['depends_on'],
  );
}