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

36 lines
1020 B
Dart
Raw Normal View History

2024-10-07 17:59:30 +04:00
import 'package:json_annotation/json_annotation.dart';
part 'characters_dto.g.dart';
@JsonSerializable(createToJson: false)
class CharactersDto {
final List<CharacterDataDto>? data;
const CharactersDto({this.data});
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class CharacterDataDto {
2024-10-07 18:19:03 +04:00
final String? id;
final String? type;
final CharacterAttributesDataDto? attributes;
2024-10-07 17:59:30 +04:00
2024-10-07 18:19:03 +04:00
const CharacterDataDto({this.id, this.type, this.attributes});
2024-10-07 17:59:30 +04:00
2024-10-07 18:19:03 +04:00
factory CharacterDataDto.fromJson(Map<String, dynamic> json) => _$CharacterDataDtoFromJson(json);
2024-10-07 17:59:30 +04:00
}
@JsonSerializable(createToJson: false)
class CharacterAttributesDataDto {
2024-10-07 18:19:03 +04:00
final String? name;
final String? born;
final String? died;
final String? image;
2024-10-07 17:59:30 +04:00
2024-10-07 18:19:03 +04:00
const CharacterAttributesDataDto({this.name, this.born, this.died, this.image});
2024-10-07 17:59:30 +04:00
2024-10-07 18:19:03 +04:00
factory CharacterAttributesDataDto.fromJson(Map<String, dynamic> json) =>
_$CharacterAttributesDataDtoFromJson(json);
}