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