import 'package:json_annotation/json_annotation.dart'; // dart run build_runner build --delete-conflicting-outputs part 'characters_dto.g.dart'; @JsonSerializable(createToJson: false) class CharactersDto { final List? data; const CharactersDto({ this.data }); factory CharactersDto.fromJson(Map json) => _$CharactersDtoFromJson(json); } @JsonSerializable(createToJson: false) class CharacterDataDto { final String? id; final CharacterAttributesDataDto? attributes; const CharacterDataDto(this.id, this.attributes); factory CharacterDataDto.fromJson(Map json) => _$CharacterDataDtoFromJson(json); } @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 json) => _$CharacterAttributesDataDtoFromJson(json); }