65 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 {
final List<PokemonDataDto>? data;
2024-11-27 22:35:25 +04:00
final int? page;
final int? pageSize;
final int? count;
final int? totalCount;
2024-10-14 21:25:43 +04:00
const PokemonDto({
this.data,
2024-11-27 22:35:25 +04:00
this.page,
this.pageSize,
this.count,
this.totalCount,
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? id;
2024-11-16 13:37:18 +04:00
final String? name;
final List<String>? types;
final List<String>? evolvesTo;
final List<PokemonAbilityDto>? abilities;
final PokemonImagesDto? images;
2024-11-27 22:01:26 +04:00
final String? artist;
2024-10-14 21:25:43 +04:00
2024-11-16 13:37:18 +04:00
const PokemonDataDto({
this.id,
2024-11-16 13:37:18 +04:00
this.name,
this.types,
this.evolvesTo,
this.abilities,
this.images,
2024-11-27 22:01:26 +04:00
this.artist,
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)
class PokemonAbilityDto {
final String? name;
final String? text;
final String? type;
const PokemonAbilityDto({this.name, this.text, this.type});
2024-10-14 21:25:43 +04:00
factory PokemonAbilityDto.fromJson(Map<String, dynamic> json) => _$PokemonAbilityDtoFromJson(json);
2024-10-14 21:25:43 +04:00
}
@JsonSerializable(createToJson: false)
class PokemonImagesDto {
final String? large;
2024-10-14 21:25:43 +04:00
const PokemonImagesDto({this.large});
2024-10-14 21:25:43 +04:00
factory PokemonImagesDto.fromJson(Map<String, dynamic> json) => _$PokemonImagesDtoFromJson(json);
2024-11-16 13:37:18 +04:00
}