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)
|
@JsonSerializable(createToJson: false)
|
||||||
class CharactersDto {
|
class CharactersDto {
|
||||||
final List<CharactersDataDto>? data;
|
final List<CharactersDataDto>? results;
|
||||||
final MetaDto? meta;
|
final InfoDto? info;
|
||||||
const CharactersDto({this.data, this.meta});
|
const CharactersDto({this.results, this.info});
|
||||||
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
|
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable(createToJson: false)
|
@JsonSerializable(createToJson: false)
|
||||||
class CharactersDataDto {
|
class CharactersDataDto {
|
||||||
final String? id;
|
final String? id;
|
||||||
final String? type;
|
final String? name;
|
||||||
final CharasterAttributesDataDto? attributes;
|
final String? status;
|
||||||
|
final List<String> species;
|
||||||
|
final String? age;
|
||||||
const CharactersDataDto({this.id, this.type, this.attributes});
|
const CharactersDataDto({this.id, this.type, this.attributes});
|
||||||
factory CharactersDataDto.fromJson(Map<String, dynamic> json) =>
|
factory CharactersDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
_$CharactersDataDtoFromJson(json);
|
_$CharactersDataDtoFromJson(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable(createToJson: false)
|
@JsonSerializable(createToJson: false)
|
||||||
class CharasterAttributesDataDto {
|
class InfoDto {
|
||||||
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 {
|
|
||||||
final PaginationDto? pagination;
|
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)
|
@JsonSerializable(createToJson: false)
|
@ -24,7 +24,7 @@ extension CharacterDataDtoToModel on CharactersDataDto {
|
|||||||
|
|
||||||
extension CharactersDtoToModel on CharactersDto {
|
extension CharactersDtoToModel on CharactersDto {
|
||||||
HomeData toDomain() => HomeData(
|
HomeData toDomain() => HomeData(
|
||||||
data: data?.map((e) => e.toDomain()).toList(),
|
data: results?.map((e) => e.toDomain()).toList(),
|
||||||
nextPage: meta?.pagination?.next,
|
nextPage: info?.pagination?.next,
|
||||||
);
|
);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user