CollectionMedia.fromJson constructor
CollectionMedia.fromJson Mapping data to CollectionMedia
Implementation
factory CollectionMedia.fromJson(Map<String, dynamic> json) {
/// [CollectionMedia] Mapping object
return CollectionMedia(
id: json['id'] != null ? json['id'] as int? : null,
type: json['type'] != null ? json['type'] as String? : null,
width: json['width'] != null ? json['width'] as int? : null,
height: json['height'] != null ? json['height'] as int? : null,
duration: json['duration'] != null ? json['duration'] as int? : null,
url: json['url'] != null ? json['url'] as String? : null,
image: json['image'] != null ? json['image'] as String? : null,
user: json['user'] != null ? User.fromJson(json['user']) : null,
videoFiles: json['video_files'] != null
? _videoFileList(json['video_files'] as List<dynamic>?)
: null,
videoPictures: json['video_pictures'] != null
? _videoPictureList(json['video_pictures'] as List<dynamic>?)
: null,
photographerId: json['photographerId'] != null
? json['photographerId'] as int?
: null,
photographer: json['photographer'] != null
? json['photographer'] as String?
: null,
photographerUrl: json['photographerUrl'] != null
? json['photographerUrl'] as String?
: null,
avgColor: json['avgColor'] != null ? json['avgColor'] as String? : null,
src: json['src'] != null ? PhotoSrc.fromJson(json['src']) : null,
liked: json['liked'] != null ? json['liked'] as bool : false,
alt: json['alt'] != null ? json['alt'] as String? : null);
}