lab7 джага джага
This commit is contained in:
parent
c82d240d4c
commit
d3dc6956f1
@ -22,8 +22,10 @@ class NewAttributesDataDto {
|
|||||||
final String? description;
|
final String? description;
|
||||||
@JsonKey(name: 'urlToImage')
|
@JsonKey(name: 'urlToImage')
|
||||||
final String? imagelink;
|
final String? imagelink;
|
||||||
|
@JsonKey(name: 'url')
|
||||||
|
final String? id;
|
||||||
|
|
||||||
const NewAttributesDataDto({this.title, this.description, this.imagelink});
|
const NewAttributesDataDto({this.id, this.title, this.description, this.imagelink});
|
||||||
|
|
||||||
factory NewAttributesDataDto.fromJson(Map<String, dynamic> json) =>
|
factory NewAttributesDataDto.fromJson(Map<String, dynamic> json) =>
|
||||||
_$NewAttributesDataDtoFromJson(json);
|
_$NewAttributesDataDtoFromJson(json);
|
||||||
|
@ -18,6 +18,7 @@ NewsDto _$NewsDtoFromJson(Map<String, dynamic> json) => NewsDto(
|
|||||||
NewAttributesDataDto _$NewAttributesDataDtoFromJson(
|
NewAttributesDataDto _$NewAttributesDataDtoFromJson(
|
||||||
Map<String, dynamic> json) =>
|
Map<String, dynamic> json) =>
|
||||||
NewAttributesDataDto(
|
NewAttributesDataDto(
|
||||||
|
id: json['url'] as String?,
|
||||||
title: json['title'] as String?,
|
title: json['title'] as String?,
|
||||||
description: json['description'] as String?,
|
description: json['description'] as String?,
|
||||||
imagelink: json['urlToImage'] as String?,
|
imagelink: json['urlToImage'] as String?,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:pmu/data/dtos/news_dto.dart';
|
import 'package:pmu/data/dtos/news_dto.dart';
|
||||||
import 'package:pmu/domain/models/card.dart';
|
import 'package:pmu/domain/models/card.dart';
|
||||||
import 'package:pmu/domain/models/home.dart';
|
import 'package:pmu/domain/models/home.dart';
|
||||||
|
int _id = 0;
|
||||||
|
|
||||||
extension NewDataDtoToModel on NewAttributesDataDto {
|
extension NewDataDtoToModel on NewAttributesDataDto {
|
||||||
CardData toDomain() => CardData(
|
CardData toDomain() => CardData(
|
||||||
@ -17,3 +18,8 @@ extension NewsDtoToModel on NewsDto {
|
|||||||
nextPage: meta?.pagination?.next,
|
nextPage: meta?.pagination?.next,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _getId(){
|
||||||
|
_id+=1;
|
||||||
|
return _id;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user