2024-09-15 21:41:47 +04:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
|
|
|
// dart run build_runner build --delete-conflicting-outputs
|
|
|
|
|
|
|
|
part 'characters_dto.g.dart';
|
|
|
|
|
2024-09-17 00:03:15 +04:00
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class CharactersDto {
|
|
|
|
final List<CharacterDataDto>? data;
|
|
|
|
|
|
|
|
const CharactersDto({ this.data });
|
|
|
|
|
|
|
|
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
|
|
|
|
}
|
|
|
|
|
2024-09-15 21:41:47 +04:00
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class CharacterDataDto {
|
2024-09-17 00:03:15 +04:00
|
|
|
final String? id;
|
|
|
|
final CharacterAttributesDataDto? attributes;
|
2024-09-15 21:41:47 +04:00
|
|
|
|
2024-09-17 00:03:15 +04:00
|
|
|
const CharacterDataDto(this.id, this.attributes);
|
2024-09-15 21:41:47 +04:00
|
|
|
|
|
|
|
factory CharacterDataDto.fromJson(Map<String, dynamic> json) => _$CharacterDataDtoFromJson(json);
|
|
|
|
}
|
2024-09-17 00:03:15 +04:00
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class CharacterAttributesDataDto {
|
|
|
|
final String? name;
|
|
|
|
final String? image;
|
|
|
|
final String? species;
|
|
|
|
|
|
|
|
CharacterAttributesDataDto(this.name, this.image, this.species);
|
|
|
|
|
|
|
|
factory CharacterAttributesDataDto.fromJson(Map<String, dynamic> json) => _$CharacterAttributesDataDtoFromJson(json);
|
|
|
|
}
|