41 lines
1.2 KiB
Dart
41 lines
1.2 KiB
Dart
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 {
|
|
final String? id;
|
|
final String? type;
|
|
final CharacterAttributesDataDto? attributes; //составной элемент
|
|
|
|
const CharacterDataDto({this.id, this.type, this.attributes});
|
|
|
|
factory CharacterDataDto.fromJson(Map<String, dynamic> json) {
|
|
print('CharacterDataDto.fromJson: $json');
|
|
return _$CharacterDataDtoFromJson(json);
|
|
}
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class CharacterAttributesDataDto {
|
|
final String? fullName;
|
|
final String? title;
|
|
final String? family;
|
|
final String? imageUrl;
|
|
|
|
const CharacterAttributesDataDto({this.fullName, this.title, this.family, this.imageUrl});
|
|
|
|
factory CharacterAttributesDataDto.fromJson(Map<String, dynamic> json) {
|
|
print('CharacterAttributesDataDto.fromJson: $json');
|
|
return _$CharacterAttributesDataDtoFromJson(json);
|
|
}
|
|
} |