Last active
December 6, 2018 05:30
-
-
Save ashishrawat2911/c5eeb2f47a7b24b437670f1aeacf81ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Article { | |
Source source; | |
String author; | |
String title; | |
String description; | |
String url; | |
String urlToImage; | |
String publishedAt; | |
String content; | |
Article( | |
{this.source, | |
this.author, | |
this.title, | |
this.description, | |
this.url, | |
this.urlToImage, | |
this.publishedAt, | |
this.content}); | |
factory Article.fromJson(Map<String, dynamic> json) { | |
return Article( | |
source: Source.fromJson(json["source"]), | |
author: json["author"], | |
title: json["title"], | |
description: json["description"], | |
url: json["url"], | |
urlToImage: json["urlToImage"], | |
publishedAt: json["publishedAt"], | |
content: json["content"]); | |
} | |
} | |
class Source { | |
String id; | |
String name; | |
Source({this.id, this.name}); | |
factory Source.fromJson(Map<String, dynamic> json) { | |
return Source( | |
id: json["id"] as String, | |
name: json["name"] as String, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment