import '../internal/json_utils.dart'; /// Detailed image data from `GET /libpod/images/{name}/json`. final class ImageDetails { /// Creates image details. const ImageDetails({ required this.id, required this.digest, required this.repoTags, required this.repoDigests, required this.createdAt, required this.size, required this.raw, }); /// Image ID. final String id; /// Image digest. final String digest; /// Known image tags. final List repoTags; /// Known image digests. final List repoDigests; /// Creation timestamp if present. final DateTime? createdAt; /// Image size in bytes. final int size; /// Raw payload. final Map raw; /// Builds [ImageDetails] from JSON. factory ImageDetails.fromJson(Map json) { return ImageDetails( id: asString(json['Id']) ?? asString(json['ID']) ?? '', digest: asString(json['Digest']) ?? asString(json['digest']) ?? '', repoTags: asJsonList( json['RepoTags'], ).map(asString).whereType().toList(growable: false), repoDigests: asJsonList( json['RepoDigests'], ).map(asString).whereType().toList(growable: false), createdAt: DateTime.tryParse(asString(json['Created']) ?? ''), size: asInt(json['Size']) ?? asInt(json['size']) ?? 0, raw: json, ); } }