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 {
|
|
|
|
final List<PokemonDataDto>? results;
|
2024-10-29 14:36:44 +04:00
|
|
|
final int? count;
|
|
|
|
final String? next;
|
|
|
|
final String? previous;
|
|
|
|
|
2024-10-29 14:54:56 +04:00
|
|
|
const PokemonDto({
|
|
|
|
this.results,
|
2024-10-29 14:36:44 +04:00
|
|
|
this.count,
|
|
|
|
this.next,
|
|
|
|
this.previous,
|
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-10-17 00:37:52 +04:00
|
|
|
final String? name;
|
2024-10-29 14:54:56 +04:00
|
|
|
final String? url;
|
2024-11-17 21:35:47 +04:00
|
|
|
final String? imageUrl;
|
2024-11-18 15:05:17 +04:00
|
|
|
final int? height;
|
|
|
|
final int? weight;
|
|
|
|
final List<AbilityDto>? abilities;
|
2024-10-17 00:37:52 +04:00
|
|
|
|
2024-10-29 14:54:56 +04:00
|
|
|
const PokemonDataDto({
|
2024-10-18 21:36:44 +04:00
|
|
|
this.name,
|
2024-10-29 14:54:56 +04:00
|
|
|
this.url,
|
2024-11-17 21:35:47 +04:00
|
|
|
this.imageUrl,
|
2024-11-16 12:59:11 +04:00
|
|
|
this.height,
|
|
|
|
this.weight,
|
|
|
|
this.abilities,
|
|
|
|
});
|
|
|
|
|
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)
|
|
|
|
class AbilityDto {
|
|
|
|
final AbilityDetailDto? ability;
|
|
|
|
|
|
|
|
const AbilityDto({this.ability});
|
|
|
|
|
|
|
|
factory AbilityDto.fromJson(Map<String, dynamic> json) => _$AbilityDtoFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class AbilityDetailDto {
|
|
|
|
final String? name;
|
|
|
|
|
|
|
|
const AbilityDetailDto({this.name});
|
|
|
|
|
|
|
|
factory AbilityDetailDto.fromJson(Map<String, dynamic> json) => _$AbilityDetailDtoFromJson(json);
|
2024-10-17 00:37:52 +04:00
|
|
|
}
|