import 'package:json_annotation/json_annotation.dart'; part 'news_dto.g.dart'; @JsonSerializable(createToJson: false) class NewsDto{ @JsonKey(name: 'articles') final List? data; const NewsDto({this.data}); factory NewsDto.fromJson(Map json) => _$NewsDtoFromJson(json); } @JsonSerializable(createToJson: false) class NewAttributesDataDto{ final String? title; final String? description; @JsonKey(name: 'urlToImage') final String? imagelink; const NewAttributesDataDto({this.title, this.description, this.imagelink }); factory NewAttributesDataDto.fromJson(Map json) => _$NewAttributesDataDtoFromJson(json); }