2024-10-14 21:25:43 +04:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
|
|
|
part 'pokemon_dto.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class PokemonDto {
|
2024-10-18 21:36:44 +04:00
|
|
|
final List<PokemonDataDto>? data;
|
|
|
|
final MetaDto? meta;
|
2024-10-14 21:25:43 +04:00
|
|
|
|
|
|
|
const PokemonDto({
|
2024-10-18 21:36:44 +04:00
|
|
|
this.data,
|
|
|
|
this.meta,
|
2024-10-14 21:25:43 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
factory PokemonDto.fromJson(Map<String, dynamic> json) => _$PokemonDtoFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-10-18 21:36:44 +04:00
|
|
|
class PokemonDataDto {
|
|
|
|
final String? id;
|
|
|
|
final String? type;
|
|
|
|
final PokemonAttributesDataDto? attributes;
|
2024-10-14 21:25:43 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
const PokemonDataDto({this.id, this.type, this.attributes});
|
2024-10-14 21:25:43 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
factory PokemonDataDto.fromJson(Map<String, dynamic> json) => _$PokemonDataDtoFromJson(json);
|
2024-10-14 21:25:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-10-18 21:36:44 +04:00
|
|
|
class PokemonAttributesDataDto {
|
2024-10-17 00:37:52 +04:00
|
|
|
final String? name;
|
2024-10-18 21:36:44 +04:00
|
|
|
final String? height;
|
|
|
|
final String? weight;
|
|
|
|
final String? image;
|
2024-10-17 00:37:52 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
const PokemonAttributesDataDto({
|
|
|
|
this.name,
|
|
|
|
this.height,
|
|
|
|
this.weight,
|
|
|
|
this.image,
|
|
|
|
});
|
2024-10-14 21:25:43 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
factory PokemonAttributesDataDto.fromJson(Map<String, dynamic> json) => _$PokemonAttributesDataDtoFromJson(json);
|
2024-10-17 00:37:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-10-18 21:36:44 +04:00
|
|
|
class MetaDto {
|
|
|
|
final PaginationDto? pagination;
|
2024-10-17 00:37:52 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
const MetaDto({this.pagination});
|
2024-10-17 00:37:52 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
factory MetaDto.fromJson(Map<String, dynamic> json) => _$MetaDtoFromJson(json);
|
2024-10-14 21:25:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-10-18 21:36:44 +04:00
|
|
|
class PaginationDto {
|
|
|
|
final int? current;
|
|
|
|
final int? next;
|
|
|
|
final int? last;
|
2024-10-14 21:25:43 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
const PaginationDto({this.current, this.next, this.last});
|
2024-10-14 21:25:43 +04:00
|
|
|
|
2024-10-18 21:36:44 +04:00
|
|
|
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
|
2024-10-17 00:37:52 +04:00
|
|
|
}
|