65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'pokemon_dto.g.dart';
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class PokemonDto {
|
|
final List<PokemonDataDto>? data;
|
|
final int? page;
|
|
final int? pageSize;
|
|
final int? count;
|
|
final int? totalCount;
|
|
|
|
const PokemonDto({
|
|
this.data,
|
|
this.page,
|
|
this.pageSize,
|
|
this.count,
|
|
this.totalCount,
|
|
});
|
|
|
|
factory PokemonDto.fromJson(Map<String, dynamic> json) => _$PokemonDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class PokemonDataDto {
|
|
final String? id;
|
|
final String? name;
|
|
final List<String>? types;
|
|
final List<String>? evolvesTo;
|
|
final List<PokemonAbilityDto>? abilities;
|
|
final PokemonImagesDto? images;
|
|
final String? artist;
|
|
|
|
const PokemonDataDto({
|
|
this.id,
|
|
this.name,
|
|
this.types,
|
|
this.evolvesTo,
|
|
this.abilities,
|
|
this.images,
|
|
this.artist,
|
|
});
|
|
|
|
factory PokemonDataDto.fromJson(Map<String, dynamic> json) => _$PokemonDataDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class PokemonAbilityDto {
|
|
final String? name;
|
|
final String? text;
|
|
final String? type;
|
|
|
|
const PokemonAbilityDto({this.name, this.text, this.type});
|
|
|
|
factory PokemonAbilityDto.fromJson(Map<String, dynamic> json) => _$PokemonAbilityDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class PokemonImagesDto {
|
|
final String? large;
|
|
|
|
const PokemonImagesDto({this.large});
|
|
|
|
factory PokemonImagesDto.fromJson(Map<String, dynamic> json) => _$PokemonImagesDtoFromJson(json);
|
|
} |