mc_gallery/lib/features/home/data/models/image_model.dart

29 lines
736 B
Dart

import 'package:json_annotation/json_annotation.dart';
part 'image_model.g.dart';
@JsonSerializable()
class ImageModel {
const ImageModel({
required this.uri,
required this.imageIndex,
required this.imageName,
});
/// An image's target [Uri].
///
/// Storing an image's [ByteData] is more expensive, memory-wise.
final Uri uri;
/// A unique identifier that can be used for indexing the image.
final int imageIndex;
/// Given name of the image.
final String imageName;
factory ImageModel.fromJson(Map<String, dynamic> json) => _$ImageModelFromJson(json);
/// Connect the generated [_$PersonToJson] function to the `toJson` method.
Map<String, dynamic> toJson() => _$ImageModelToJson(this);
}