File.fromJson constructor

File.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory File.fromJson(Map<String, Object?> json) => File(
      id: json["id"] as String,
      purpose: json["purpose"] as String,
      status: Status.fromJson(json["status"]),
      scanStatus: ScanStatus.fromJson(json["scan_status"]),
      name: json["name"] == null ? null : json["name"] as String,
      filename: json["filename"] == null ? null : json["filename"] as String,
      contentType: json["content_type"] as String,
      size: (json["size"] as num).toInt(),
      checksumSha256: json["checksum_sha256"] as String,
      createdBy: Actor.fromJson(
        (json["created_by"] as Map).cast<String, Object?>(),
      ),
      source: Source.fromJson(
        (json["source"] as Map).cast<String, Object?>(),
      ),
      media: json["media"] == null
          ? null
          : Media.fromJson((json["media"] as Map).cast<String, Object?>()),
      storage: PublicStorage.fromJson(
        (json["storage"] as Map).cast<String, Object?>(),
      ),
      delivery: json["delivery"] == null
          ? null
          : DeliveryDetails.fromJson(
              (json["delivery"] as Map).cast<String, Object?>(),
            ),
      latestError: json["latest_error"] == null
          ? null
          : LatestError.fromJson(
              (json["latest_error"] as Map).cast<String, Object?>(),
            ),
      customData: json["custom_data"] == null
          ? null
          : core.CustomData.fromJson(json["custom_data"]),
      metadata: json["metadata"] == null
          ? null
          : core.FileMetadata.fromJson(json["metadata"]),
      createdAt: decodeDateTime(json["created_at"]),
      updatedAt: decodeDateTime(json["updated_at"]),
      availableAt: json["available_at"] == null
          ? null
          : decodeDateTime(json["available_at"]),
      expiresAt: json["expires_at"] == null
          ? null
          : decodeDateTime(json["expires_at"]),
    );