21 lines
686 B
Dart
21 lines
686 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
part 'news_dto.g.dart';
|
|
@JsonSerializable(createToJson: false)
|
|
class NewsDto{
|
|
@JsonKey(name: 'articles')
|
|
final List<NewAttributesDataDto>? data;
|
|
const NewsDto({this.data});
|
|
factory NewsDto.fromJson(Map<String, dynamic> 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<String, dynamic> json) => _$NewAttributesDataDtoFromJson(json);
|
|
} |