PIbd-32_Chubykina_P.P._mobilki/lib/data/dtos/pokemon_dto.dart

33 lines
701 B
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)
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 {
final String? name;
2024-10-29 14:54:56 +04:00
final String? url;
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-10-18 21:36:44 +04:00
});
2024-10-14 21:25:43 +04:00
2024-10-29 14:54:56 +04:00
factory PokemonDataDto.fromJson(Map<String, dynamic> json) => _$PokemonDataDtoFromJson(json);
}