47 lines
1.2 KiB
Dart
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, 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({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({this.current, this.next, this.last});
|
|
|
|
factory PaginationDto.fromJson(Map<String, dynamic> json) =>
|
|
_$PaginationDtoFromJson(json);
|
|
} |