Property.fromJson constructor

Property.fromJson(
  1. Map<String, dynamic> json,
  2. PrefixMapping prefixMapping
)

Creates a new Property from a json object.

Implementation

factory Property.fromJson(
  Map<String, dynamic> json,
  PrefixMapping prefixMapping,
) {
  final Set<String> parsedFields = {};
  final observable =
      json.parseField<bool>("observable", parsedFields) ?? false;
  final uriVariables = json.parseDataSchemaMapField(
    "uriVariables",
    prefixMapping,
    parsedFields,
  );
  final dataSchema = DataSchema.fromJson(json, prefixMapping, parsedFields);
  final forms = json.parseAffordanceForms(
    prefixMapping,
    parsedFields,
  );

  final additionalFields =
      json.parseAdditionalFields(prefixMapping, parsedFields);

  final property = Property(
    forms: forms,
    observable: observable,
    dataSchema: dataSchema,
    uriVariables: uriVariables,
    additionalFields: additionalFields,
  );

  return property;
}