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