2024-11-15 21:47:58 +04:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
//автоматически сгенерился
|
|
|
|
part 'games_dto.g.dart';
|
|
|
|
|
|
|
|
// createToJson:false - указание, что сериализатор не нужен, нужен только десериализатор
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class GamesDto {
|
|
|
|
@JsonKey(name: 'results')
|
|
|
|
final List<GameDto>? data;
|
|
|
|
|
2024-11-19 23:39:56 +04:00
|
|
|
final int? current;
|
|
|
|
final int? next;
|
|
|
|
// final int? previous;
|
|
|
|
|
|
|
|
const GamesDto({this.data, this.current, this.next});
|
2024-11-15 21:47:58 +04:00
|
|
|
|
|
|
|
factory GamesDto.fromJson(Map<String, dynamic> json) => _$GamesDtoFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class GameDto {
|
2024-11-19 23:39:56 +04:00
|
|
|
//для получения описания игры
|
2024-11-15 21:47:58 +04:00
|
|
|
@JsonKey(name: 'id')
|
|
|
|
final int? id;
|
|
|
|
|
|
|
|
final String? name;
|
|
|
|
|
|
|
|
final String? description;
|
|
|
|
|
|
|
|
|
|
|
|
@JsonKey(name: 'background_image')
|
|
|
|
final String? image;
|
|
|
|
|
|
|
|
@JsonKey(name: 'released')
|
|
|
|
final String? date;
|
|
|
|
|
|
|
|
const GameDto(this.id, this.name, this.description, this.image, this.date);
|
|
|
|
|
|
|
|
factory GameDto.fromJson(Map<String, dynamic> json) => _$GameDtoFromJson(json);
|
2024-11-19 23:39:56 +04:00
|
|
|
}
|