fromJson static method
Implementation
static CdnAssetMetadata? fromJson(dynamic value) {
if (value is! Map) return null;
final hash = value['hash']?.toString().trim().toLowerCase();
final size = _intFromJson(value['size']);
if (hash == null ||
!_sha256Pattern.hasMatch(hash) ||
size == null ||
size < 0) {
return null;
}
return CdnAssetMetadata(
hash: hash,
size: size,
contentType: value['contentType']?.toString(),
updatedAt: _intFromJson(value['updatedAt']),
);
}