PMU/lib/data/dtos/recipes_dto.dart

42 lines
947 B
Dart
Raw Permalink Normal View History

2024-12-18 17:20:52 +04:00
import 'package:json_annotation/json_annotation.dart';
2024-12-19 11:41:08 +04:00
part 'recipes_dto.g.dart';
2024-12-18 17:20:52 +04:00
@JsonSerializable(createToJson: false)
class RecipesDto {
2024-12-19 11:41:08 +04:00
final List<RecipeDataDto>? hits;
2024-12-18 17:20:52 +04:00
const RecipesDto({this.hits});
factory RecipesDto.fromJson(Map<String, dynamic> json) =>
_$RecipesDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class RecipeDataDto {
2024-12-19 11:41:08 +04:00
final RecipeAttributesDataDto? recipe;
2024-12-18 17:20:52 +04:00
const RecipeDataDto({this.recipe});
factory RecipeDataDto.fromJson(Map<String, dynamic> json) =>
_$RecipeDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class RecipeAttributesDataDto {
final String? label;
2024-12-19 11:41:08 +04:00
final double? calories;
2024-12-18 17:20:52 +04:00
final String? url;
final String? image;
const RecipeAttributesDataDto({
this.label,
this.calories,
this.url,
this.image,
});
factory RecipeAttributesDataDto.fromJson(Map<String, dynamic> json) =>
_$RecipeAttributesDataDtoFromJson(json);
}