PMD_labs/lib/data/dtos/titans_dto.dart

44 lines
1.2 KiB
Dart
Raw Normal View History

2024-11-27 23:10:56 +04:00
import 'package:json_annotation/json_annotation.dart';
part 'characters_dto.g.dart';
@JsonSerializable(createToJson: false)
2024-12-17 14:33:28 +04:00
class CharactersDto {
2024-12-20 14:49:52 +04:00
final List<CharactersDataDto>? results;
final InfoDto? info;
const CharactersDto({this.results, this.info});
2024-11-27 23:10:56 +04:00
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
2024-12-17 14:33:28 +04:00
class CharactersDataDto {
2024-11-27 23:10:56 +04:00
final String? id;
2024-12-20 14:49:52 +04:00
final String? name;
final String? status;
final List<String> species;
final String? age;
2024-11-27 23:10:56 +04:00
const CharactersDataDto({this.id, this.type, this.attributes});
2024-12-17 14:33:28 +04:00
factory CharactersDataDto.fromJson(Map<String, dynamic> json) =>
_$CharactersDataDtoFromJson(json);
2024-11-27 23:10:56 +04:00
}
@JsonSerializable(createToJson: false)
2024-12-20 14:49:52 +04:00
class InfoDto {
2024-12-17 11:50:32 +04:00
final PaginationDto? pagination;
2024-12-20 14:49:52 +04:00
const InfoDto({this.pagination});
2024-12-17 11:50:32 +04:00
2024-12-20 14:49:52 +04:00
factory InfoDto.fromJson(Map<String, dynamic> json) => _$MetaDtoFromJson(json);
2024-12-17 11:50:32 +04:00
}
@JsonSerializable(createToJson: false)
class PaginationDto {
final int? current;
final int? next;
final int? last;
const PaginationDto({this.current, this.next, this.last});
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
2024-12-17 14:33:28 +04:00
}