Properties.fromJson constructor

Properties.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Properties.fromJson(Map<String, dynamic> json) => Properties(
      fields:
          json.containsKey('fields') ? json['fields'].cast<String>() : null,
      key: json['key'],
      title: json['title'],
      description: json['description'],
      type: stringToJsonSchemaType[json['type']] ?? JsonSchemaType.none,
      maxLine: json["maxline"],
      isRequired: json['is_mandatory'] ?? false,
      readOnly: json['readOnly'] ?? false,
      answer: json['type'] == "checkbox"
          ? List.generate(
              json['fields'].cast<String>().length, (index) => false)
          : null,
      validations: json['validations'] is Map<String, dynamic>
          ? ValidationSchema.fromJSON(json['validations'])
          : null,
      raw: json.containsKey('raw')
          ? List<RawBuilder>.from(
              json['raw'].map((el) => RawBuilder.fromJson(el)))
          : null,
    );