PMU_Repo/lib/data/dtos/characters_dto.dart
2024-12-20 20:30:13 +04:00

47 lines
1.2 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'characters_dto.g.dart';
@JsonSerializable(createToJson: false)
class CharactersDto {
final List<CharactersDataDto>? data;
final MetaDto meta;
const CharactersDto ({this.data, required this.meta});
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class CharactersDataDto {
final int id;
final String fullName;
final String title;
final String family;
final String imageUrl;
const CharactersDataDto(this.id, this.fullName, this.title, this.family, this.imageUrl);
factory CharactersDataDto.fromJson(Map<String, dynamic> json) => _$CharactersDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class MetaDto {
final PaginationDto pagination;
const MetaDto({required this.pagination});
factory MetaDto.fromJson(Map<String, dynamic> json) =>
_$MetaDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class PaginationDto {
final int current;
final int next;
final int last;
const PaginationDto({required this.current, required this.next, required this.last});
factory PaginationDto.fromJson(Map<String, dynamic> json) =>
_$PaginationDtoFromJson(json);
}