2024-11-15 21:47:58 +04:00
|
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
|
|
|
|
|
|
part of 'games_dto.dart';
|
|
|
|
|
|
|
|
|
|
// **************************************************************************
|
|
|
|
|
// JsonSerializableGenerator
|
|
|
|
|
// **************************************************************************
|
|
|
|
|
|
|
|
|
|
GamesDto _$GamesDtoFromJson(Map<String, dynamic> json) => GamesDto(
|
2024-11-19 23:39:56 +04:00
|
|
|
|
data: (json['results'] as List<dynamic>?)
|
|
|
|
|
?.map((e) => GameDto.fromJson(e as Map<String, dynamic>))
|
|
|
|
|
.toList(),
|
|
|
|
|
current: getNextPageNumber(json['next']) != null ? getNextPageNumber(json['next'])! - 1 : null,
|
|
|
|
|
next: getNextPageNumber(json['next']),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
int? getNextPageNumber(String url) {
|
|
|
|
|
RegExp regExp = RegExp(r'page=(\d+)');
|
|
|
|
|
Match? match = regExp.firstMatch(url);
|
|
|
|
|
String? number;
|
|
|
|
|
if (match != null) {
|
|
|
|
|
return int.parse(match.group(1)!);
|
|
|
|
|
}
|
|
|
|
|
//по умолчанию след. = 2, т.е. тек. = 1
|
|
|
|
|
else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-15 21:47:58 +04:00
|
|
|
|
|
|
|
|
|
GameDto _$GameDtoFromJson(Map<String, dynamic> json) => GameDto(
|
|
|
|
|
(json['id'] as num?)?.toInt(),
|
|
|
|
|
json['name'] as String?,
|
|
|
|
|
json['description'] as String?,
|
|
|
|
|
json['background_image'] as String?,
|
|
|
|
|
json['released'] as String?,
|
|
|
|
|
);
|