attributeModelfromJson<T> function
Deserializes an AttributeModel of type T using a converter for the value.
The converter fromJsonT transforms the raw JSON field into T.
Minimal runnable example
void main() {
final Map<String, dynamic> json = <String, dynamic>{
'name': 'weight',
'value': 70,
};
final AttributeModel<int> attr = attributeModelFromJson<int>(
json,
(dynamic v) => v as int,
);
print(attr.name); // weight
print(attr.value); // 70
}
Implementation
@Deprecated('Use static from<T> instead.')
AttributeModel<T> attributeModelfromJson<T>(
Map<String, dynamic> json,
T Function(dynamic) fromJsonT,
) =>
attributeModelFromJson<T>(json, fromJsonT);