66 lines
1.5 KiB
Dart
Raw Normal View History

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-11-16 13:37:18 +04:00
final List<PokemonDataDto>? results;
final int? count;
final String? next;
final String? previous;
2024-10-14 21:25:43 +04:00
const PokemonDto({
2024-11-16 13:37:18 +04:00
this.results,
this.count,
this.next,
this.previous,
2024-10-14 21:25:43 +04:00
});
factory PokemonDto.fromJson(Map<String, dynamic> json) => _$PokemonDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
2024-11-16 13:37:18 +04:00
class PokemonDataDto {
final String? name;
final String? url;
2024-10-14 21:25:43 +04:00
2024-11-16 13:37:18 +04:00
const PokemonDataDto({
this.name,
this.url,
2024-10-14 21:25:43 +04:00
});
2024-11-16 13:37:18 +04:00
factory PokemonDataDto.fromJson(Map<String, dynamic> json) => _$PokemonDataDtoFromJson(json);
2024-10-14 21:25:43 +04:00
}
@JsonSerializable(createToJson: false)
2024-11-16 13:37:18 +04:00
class PokemonDetailsDto {
final int? height;
final int? weight;
final List<AbilityDto>? abilities;
2024-10-14 21:25:43 +04:00
2024-11-16 13:37:18 +04:00
const PokemonDetailsDto({
this.height,
this.weight,
this.abilities,
2024-10-14 21:25:43 +04:00
});
2024-11-16 13:37:18 +04:00
factory PokemonDetailsDto.fromJson(Map<String, dynamic> json) => _$PokemonDetailsDtoFromJson(json);
2024-10-14 21:25:43 +04:00
}
@JsonSerializable(createToJson: false)
2024-11-16 13:37:18 +04:00
class AbilityDto {
final AbilityDetailDto? ability;
2024-10-14 21:25:43 +04:00
2024-11-16 13:37:18 +04:00
const AbilityDto({this.ability});
2024-10-14 21:25:43 +04:00
2024-11-16 13:37:18 +04:00
factory AbilityDto.fromJson(Map<String, dynamic> json) => _$AbilityDtoFromJson(json);
2024-10-16 23:18:15 +04:00
}
2024-11-16 13:37:18 +04:00
@JsonSerializable(createToJson: false)
class AbilityDetailDto {
final String? name;
const AbilityDetailDto({this.name});
factory AbilityDetailDto.fromJson(Map<String, dynamic> json) => _$AbilityDetailDtoFromJson(json);
}