fromJson static method

FileMetadata fromJson(
  1. dynamic json
)

Implementation

static FileMetadata fromJson(dynamic json) {
  return FileMetadata(
    // TODO(https://github.com/nhost/hasura-backend-plus/issues/436): In
    // order to work around inconsistencies in the backend's naming of this
    // field, we duplicate.
    key: (json['Key'] ?? json['key']) as String,
    acceptRanges: json['AcceptRanges'] as String?,
    lastModified: json['LastModified'] == null
        ? null
        : DateTime.parse(json['LastModified'] as String),
    contentLength: json['ContentLength'] as int?,
    eTag: json['ETag'] as String?,
    contentType: json['ContentType'] as String?,
    nhostMetadata: json['Metadata'] == null
        ? null
        : FileNhostMetadata.fromJson(
            json['Metadata'] as Map<String, dynamic>),
  );
}