60 lines
1.6 KiB
Dart
Raw Normal View History

2024-09-20 16:16:06 +04:00
import 'package:json_annotation/json_annotation.dart';
// dart run build_runner build --delete-conflicting-outputs
2024-09-30 04:34:25 +04:00
// flutter pub run build_runner build --delete-conflicting-outputs
2024-09-20 16:16:06 +04:00
2024-09-30 04:34:25 +04:00
part 'houses_dto.g.dart';
2024-09-20 16:16:06 +04:00
@JsonSerializable(createToJson: false)
class HousesDto {
final List<HouseDataDto>? data;
2024-09-30 04:34:25 +04:00
final MetaDto? meta;
const HousesDto({this.data, this.meta});
factory HousesDto.fromJson(Map<String, dynamic> json) => _$HousesDtoFromJson(json);
2024-09-30 04:34:25 +04:00
}
@JsonSerializable(createToJson: false)
class MetaDto {
final PaginationDto? pagination;
const MetaDto({this.pagination});
factory MetaDto.fromJson(Map<String, dynamic> json) => _$MetaDtoFromJson(json);
2024-09-30 04:34:25 +04:00
}
@JsonSerializable(createToJson: false)
class PaginationDto {
final int? current;
final int? next;
final int? last;
2024-09-20 16:16:06 +04:00
2024-09-30 04:34:25 +04:00
const PaginationDto({this.current, this.last, this.next});
2024-09-20 16:16:06 +04:00
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
2024-09-20 16:16:06 +04:00
}
@JsonSerializable(createToJson: false)
class HouseDataDto {
final String? id;
final HouseAttributesDataDto? attributes;
const HouseDataDto(this.id, this.attributes);
factory HouseDataDto.fromJson(Map<String, dynamic> json) => _$HouseDataDtoFromJson(json);
2024-09-20 16:16:06 +04:00
}
@JsonSerializable(createToJson: false)
class HouseAttributesDataDto {
final String? name;
final String? location;
final String? image;
final String? description;
HouseAttributesDataDto(this.name, this.location, this.image, this.description);
2024-09-20 16:16:06 +04:00
2024-09-30 04:34:25 +04:00
factory HouseAttributesDataDto.fromJson(Map<String, dynamic> json) =>
_$HouseAttributesDataDtoFromJson(json);
2024-09-20 16:16:06 +04:00
}