fromJsonOrNull static method
Constructs a new instance of ReferencedModel,
from json
, which must be a valid JSON object. Returns null
if
json
is null
or if the conversion fails.
Implementation
static ReferencedModel? fromJsonOrNull(
Map<String, dynamic>? json,
) {
try {
final id = json?['id']?.toString().trim().nullIfEmpty;
final ref = dataRefFromString(json?['ref']?.toString());
return ReferencedModel(
id: id,
ref: ref,
);
} catch (e) {
return null;
}
}