propertyFromJson static method
Create a new Property instance from json.
Receive a json
from where the information is extracted.
Implementation
static Property propertyFromJson(Map<String, dynamic> json) {
PropertiesTypes type = extractPropertyType(json);
if (type == PropertiesTypes.Title) {
bool contentIsList = Property.contentIsList(json, type);
return TitleProp.fromJson(json, subfield: contentIsList ? null : 'title');
} else if (type == PropertiesTypes.RichText) {
return RichTextProp.fromJson(json);
} else if (type == PropertiesTypes.MultiSelect) {
bool contentIsList = MultiSelectProp.contentIsList(json);
MultiSelectProp multi = MultiSelectProp.fromJson(json,
subfield: contentIsList ? null : 'options');
return multi;
} else {
return Property();
}
}