PixabayVideo.fromJson constructor
PixabayVideo.fromJson(
- Map<String, dynamic> data
)
Implementation
factory PixabayVideo.fromJson(Map<String, dynamic> data) {
Map large = data['videos']["large"];
Map medium = data['videos']["medium"];
Map small = data['videos']["small"];
List<PixabayVideoDescriptor> videos = [
new PixabayVideoDescriptor(
url: large['url'],
height: large['height'],
width: large['width'],
size: large['size'],
res: Resolution.large),
new PixabayVideoDescriptor(
url: medium['url'],
height: medium['height'],
width: medium['width'],
size: medium['size'],
res: Resolution.medium),
new PixabayVideoDescriptor(
url: small['url'],
height: small['height'],
width: small['width'],
size: small['size'],
res: Resolution.small)
];
return new PixabayVideo(
id: data['id'],
pageURL: data['pageURL'],
type: data["type"],
tags: data["tags"],
duration: data["duration"],
pictureId: data["picture_id"],
videos: videos,
views: data["views"],
downloads: data["downloads"],
favorites: data["favorites"],
likes: data["likes"],
comments: data["comments"],
userId: data["user_id"],
user: data["user"],
userImageURL: data["userImageURL"],
);
}