setFromJson method
Convert any given json to correspondig types and store it. If fails, it returns false.
Implementation
@override
bool setFromJson(json) {
if (json is PrimitieveJson &&
json.valueOrNull is T &&
json.valueOrNull != null) {
set(json.valueOrNull);
return true;
}
final parsed = tryParse(json is JsonType ? json.toJson() : json);
if (parsed is T) {
set(parsed);
return true;
} else {
_value = null;
return false;
}
}