Created
May 23, 2018 08:00
-
-
Save vipulasri/669e76299f1784d13ad3aa311ccf1e9d to your computer and use it in GitHub Desktop.
Painting Response
This file contains hidden or 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 PaintingResponse { | |
List<Painting> paintings; | |
PaintingResponse(this.paintings); | |
PaintingResponse.fromJson(Map<String, dynamic> json) { | |
if (json['Paintings'] != null) { | |
paintings = new List<Painting>(); | |
json['Paintings'].forEach((v) { | |
paintings.add(new Painting.fromJson(v)); | |
}); | |
} | |
} | |
Map<String, dynamic> toJson() { | |
final Map<String, dynamic> data = new Map<String, dynamic>(); | |
if (this.paintings != null) { | |
data['Paintings'] = this.paintings.map((v) => v.toJson()).toList(); | |
} | |
return data; | |
} | |
} |
This file contains hidden or 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 Painting { | |
String _id; | |
String _title; | |
String _year; | |
int _width; | |
int _height; | |
String _artistName; | |
String _image; | |
String _map; | |
String _paintingUrl; | |
String _artistUrl; | |
Painting( | |
{String id, | |
String title, | |
String year, | |
int width, | |
int height, | |
String artistName, | |
String image, | |
String map, | |
String paintingUrl, | |
String artistUrl}) { | |
this._id = id; | |
this._title = title; | |
this._year = year; | |
this._width = width; | |
this._height = height; | |
this._artistName = artistName; | |
this._image = image; | |
this._map = map; | |
this._paintingUrl = paintingUrl; | |
this._artistUrl = artistUrl; | |
} | |
String get id => _id; | |
set id(String id) => _id = id; | |
String get title => _title; | |
set title(String title) => _title = title; | |
String get year => _year; | |
set year(String year) => _year = year; | |
int get width => _width; | |
set width(int width) => _width = width; | |
int get height => _height; | |
set height(int height) => _height = height; | |
String get artistName => _artistName; | |
set artistName(String artistName) => _artistName = artistName; | |
String get image => _image; | |
set image(String image) => _image = image; | |
String get map => _map; | |
set map(String map) => _map = map; | |
String get paintingUrl => _paintingUrl; | |
set paintingUrl(String paintingUrl) => _paintingUrl = paintingUrl; | |
String get artistUrl => _artistUrl; | |
set artistUrl(String artistUrl) => _artistUrl = artistUrl; | |
Painting.fromJson(Map<String, dynamic> json) { | |
_id = json['id']; | |
_title = json['title']; | |
_year = json['year']; | |
_width = json['width']; | |
_height = json['height']; | |
_artistName = json['artistName']; | |
_image = json['image']; | |
_map = json['map']; | |
_paintingUrl = json['paintingUrl']; | |
_artistUrl = json['artistUrl']; | |
} | |
Map<String, dynamic> toJson() { | |
final Map<String, dynamic> data = new Map<String, dynamic>(); | |
data['id'] = this._id; | |
data['title'] = this._title; | |
data['year'] = this._year; | |
data['width'] = this._width; | |
data['height'] = this._height; | |
data['artistName'] = this._artistName; | |
data['image'] = this._image; | |
data['map'] = this._map; | |
data['paintingUrl'] = this._paintingUrl; | |
data['artistUrl'] = this._artistUrl; | |
return data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment