2024-10-14 21:25:43 +04:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
|
|
|
part 'pokemon_dto.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-10-29 14:54:56 +04:00
|
|
|
class PokemonDto {
|
2024-11-19 23:43:02 +04:00
|
|
|
final List<PokemonDataDto>? data;
|
|
|
|
final MetaDto? meta;
|
2024-10-29 14:36:44 +04:00
|
|
|
|
2024-10-29 14:54:56 +04:00
|
|
|
const PokemonDto({
|
2024-11-19 23:43:02 +04:00
|
|
|
this.data,
|
|
|
|
this.meta,
|
2024-10-14 21:25:43 +04:00
|
|
|
});
|
|
|
|
|
2024-10-29 14:36:44 +04:00
|
|
|
factory PokemonDto.fromJson(Map<String, dynamic> json) => _$PokemonDtoFromJson(json);
|
2024-10-14 21:25:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-10-29 14:54:56 +04:00
|
|
|
class PokemonDataDto {
|
2024-11-19 23:43:02 +04:00
|
|
|
final String? id;
|
2024-10-17 00:37:52 +04:00
|
|
|
final String? name;
|
2024-11-19 23:43:02 +04:00
|
|
|
final List<String>? types;
|
|
|
|
final List<String>? evolvesTo;
|
|
|
|
final PokemonImagesDto? images;
|
2024-10-17 00:37:52 +04:00
|
|
|
|
2024-10-29 14:54:56 +04:00
|
|
|
const PokemonDataDto({
|
2024-11-19 23:43:02 +04:00
|
|
|
this.id,
|
2024-10-18 21:36:44 +04:00
|
|
|
this.name,
|
2024-11-19 23:43:02 +04:00
|
|
|
this.types,
|
|
|
|
this.evolvesTo,
|
|
|
|
this.images,
|
2024-11-16 12:59:11 +04:00
|
|
|
});
|
|
|
|
|
2024-11-18 13:20:53 +04:00
|
|
|
factory PokemonDataDto.fromJson(Map<String, dynamic> json) => _$PokemonDataDtoFromJson(json);
|
2024-11-16 12:59:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-11-19 23:43:02 +04:00
|
|
|
class PokemonImagesDto {
|
|
|
|
final String? small;
|
2024-11-16 12:59:11 +04:00
|
|
|
|
2024-11-19 23:43:02 +04:00
|
|
|
const PokemonImagesDto({this.small});
|
2024-11-16 12:59:11 +04:00
|
|
|
|
2024-11-19 23:43:02 +04:00
|
|
|
factory PokemonImagesDto.fromJson(Map<String, dynamic> json) => _$PokemonImagesDtoFromJson(json);
|
2024-11-16 12:59:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-11-19 23:43:02 +04:00
|
|
|
class MetaDto {
|
|
|
|
final PaginationDto? pagination;
|
2024-11-16 12:59:11 +04:00
|
|
|
|
2024-11-19 23:43:02 +04:00
|
|
|
const MetaDto({this.pagination});
|
2024-11-16 12:59:11 +04:00
|
|
|
|
2024-11-19 23:43:02 +04:00
|
|
|
factory MetaDto.fromJson(Map<String, dynamic> json) => _$MetaDtoFromJson(json);
|
2024-11-18 16:28:59 +04:00
|
|
|
}
|
|
|
|
|
2024-11-19 23:43:02 +04:00
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class PaginationDto {
|
|
|
|
final int? current;
|
|
|
|
final int? next;
|
|
|
|
final int? last;
|
|
|
|
|
|
|
|
const PaginationDto({this.current, this.next, this.last});
|
|
|
|
|
|
|
|
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
|
|
|
|
}
|