in process
This commit is contained in:
parent
386c3087b0
commit
63aa49af9d
@ -1,49 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'characters_dto.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CharactersDto _$CharactersDtoFromJson(Map<String, dynamic> json) =>
|
||||
CharactersDto(
|
||||
data: (json['data'] as List<dynamic>?)
|
||||
?.map((e) => CharactersDataDto.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
meta: json['meta'] == null
|
||||
? null
|
||||
: MetaDto.fromJson(json['meta'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
CharactersDataDto _$CharactersDataDtoFromJson(Map<String, dynamic> json) =>
|
||||
CharactersDataDto(
|
||||
id: json['id'] as String?,
|
||||
type: json['type'] as String?,
|
||||
attributes: json['attributes'] == null
|
||||
? null
|
||||
: CharasterAttributesDataDto.fromJson(
|
||||
json['attributes'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
CharasterAttributesDataDto _$CharasterAttributesDataDtoFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
CharasterAttributesDataDto(
|
||||
name: json['name'] as String?,
|
||||
born: json['born'] as String?,
|
||||
died: json['died'] as String?,
|
||||
image: json['image'] as String?,
|
||||
);
|
||||
|
||||
MetaDto _$MetaDtoFromJson(Map<String, dynamic> json) => MetaDto(
|
||||
pagination: json['pagination'] == null
|
||||
? null
|
||||
: PaginationDto.fromJson(json['pagination'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
PaginationDto _$PaginationDtoFromJson(Map<String, dynamic> json) =>
|
||||
PaginationDto(
|
||||
current: (json['current'] as num?)?.toInt(),
|
||||
next: (json['next'] as num?)?.toInt(),
|
||||
last: (json['last'] as num?)?.toInt(),
|
||||
);
|
@ -4,41 +4,31 @@ part 'characters_dto.g.dart';
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
||||
class CharactersDto {
|
||||
final List<CharactersDataDto>? data;
|
||||
final MetaDto? meta;
|
||||
const CharactersDto({this.data, this.meta});
|
||||
final List<CharactersDataDto>? results;
|
||||
final InfoDto? info;
|
||||
const CharactersDto({this.results, this.info});
|
||||
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
||||
class CharactersDataDto {
|
||||
final String? id;
|
||||
final String? type;
|
||||
final CharasterAttributesDataDto? attributes;
|
||||
final String? name;
|
||||
final String? status;
|
||||
final List<String> species;
|
||||
final String? age;
|
||||
const CharactersDataDto({this.id, this.type, this.attributes});
|
||||
factory CharactersDataDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$CharactersDataDtoFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
||||
class CharasterAttributesDataDto {
|
||||
final String? name;
|
||||
final String? born;
|
||||
final String? died;
|
||||
final String? image;
|
||||
|
||||
const CharasterAttributesDataDto({this.name, this.born, this.died, this.image});
|
||||
factory CharasterAttributesDataDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$CharasterAttributesDataDtoFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
||||
class MetaDto {
|
||||
class InfoDto {
|
||||
final PaginationDto? pagination;
|
||||
|
||||
const MetaDto({this.pagination});
|
||||
const InfoDto({this.pagination});
|
||||
|
||||
factory MetaDto.fromJson(Map<String, dynamic> json) => _$MetaDtoFromJson(json);
|
||||
factory InfoDto.fromJson(Map<String, dynamic> json) => _$MetaDtoFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable(createToJson: false)
|
@ -24,7 +24,7 @@ extension CharacterDataDtoToModel on CharactersDataDto {
|
||||
|
||||
extension CharactersDtoToModel on CharactersDto {
|
||||
HomeData toDomain() => HomeData(
|
||||
data: data?.map((e) => e.toDomain()).toList(),
|
||||
nextPage: meta?.pagination?.next,
|
||||
data: results?.map((e) => e.toDomain()).toList(),
|
||||
nextPage: info?.pagination?.next,
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user