32 lines
750 B
Dart
32 lines
750 B
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? name;
|
|
final String? role;
|
|
final int? age;
|
|
final String? description;
|
|
final String? image;
|
|
|
|
const CharacterDataDto(
|
|
{this.id, this.name, this.role, this.age, this.description, this.image});
|
|
|
|
factory CharacterDataDto.fromJson(Map<String, dynamic> json) =>
|
|
_$CharacterDataDtoFromJson(json);
|
|
}
|