42 lines
947 B
Dart
42 lines
947 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'recipes_dto.g.dart';
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class RecipesDto {
|
|
final List<RecipeDataDto>? hits;
|
|
|
|
const RecipesDto({this.hits});
|
|
|
|
factory RecipesDto.fromJson(Map<String, dynamic> json) =>
|
|
_$RecipesDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class RecipeDataDto {
|
|
final RecipeAttributesDataDto? recipe;
|
|
|
|
const RecipeDataDto({this.recipe});
|
|
|
|
factory RecipeDataDto.fromJson(Map<String, dynamic> json) =>
|
|
_$RecipeDataDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class RecipeAttributesDataDto {
|
|
final String? label;
|
|
final double? calories;
|
|
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);
|
|
}
|