92 lines
2.2 KiB
Dart
92 lines
2.2 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'pokemon_dto.g.dart';
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class PokemonDto {
|
|
final List<PokemonDataDto>? results;
|
|
final int? count;
|
|
final String? next;
|
|
final String? previous;
|
|
|
|
const PokemonDto({
|
|
this.results,
|
|
this.count,
|
|
this.next,
|
|
this.previous,
|
|
});
|
|
|
|
factory PokemonDto.fromJson(Map<String, dynamic> json) => _$PokemonDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class PokemonDataDto {
|
|
final String? name;
|
|
final String? url;
|
|
final String? imageUrl;
|
|
final int? height;
|
|
final int? weight;
|
|
final List<AbilityDto>? abilities;
|
|
// final PokemonAttributesDataDto? attributes;
|
|
|
|
const PokemonDataDto({
|
|
this.name,
|
|
this.url,
|
|
this.imageUrl,
|
|
this.height,
|
|
this.weight,
|
|
this.abilities,
|
|
// this.attributes,
|
|
});
|
|
|
|
factory PokemonDataDto.fromJson(Map<String, dynamic> json) => _$PokemonDataDtoFromJson(json);
|
|
}
|
|
|
|
// @JsonSerializable(createToJson: false)
|
|
// class PokemonAttributesDataDto {
|
|
// final String? imageUrl;
|
|
// final int? height;
|
|
// final int? weight;
|
|
// final List<AbilityDto>? abilities;
|
|
// final PokemonSpritesDto? sprites;
|
|
//
|
|
// const PokemonAttributesDataDto({
|
|
// this.imageUrl,
|
|
// this.height,
|
|
// this.weight,
|
|
// this.abilities,
|
|
// this.sprites,
|
|
// });
|
|
//
|
|
// factory PokemonAttributesDataDto.fromJson(Map<String, dynamic> json) => _$PokemonAttributesDataDtoFromJson(json);
|
|
// }
|
|
|
|
@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);
|
|
}
|
|
|
|
// @JsonSerializable(createToJson: false)
|
|
// class PokemonSpritesDto {
|
|
// final String front_default;
|
|
//
|
|
// const PokemonSpritesDto({
|
|
// required this.front_default,
|
|
// });
|
|
//
|
|
// factory PokemonSpritesDto.fromJson(Map<String, dynamic> json) => _$PokemonSpritesDtoFromJson(json);
|
|
// }
|