Collection.fromJson constructor

Collection.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Collection.fromJson(Map<String, dynamic> json) {
  return Collection(
    source: json,
    id: json['id'] as String,
    title: json['title'] as String,
    description: json['description'] as String?,
    publishedAt: (json['published_at'] as String).let(DateTime.parse),
    updatedAt: (json['updated_at'] as String).let(DateTime.parse),
    coverPhoto: (json['cover_photo'] as Map<String, dynamic>?)
        ?.let((it) => Photo.fromJson(it)),
    user: ((json['user'] as Map<String, dynamic>)
        .let((it) => User.fromJson(it))),
    featured: json['featured'] as bool,
    totalPhotos: json['total_photos'] as int,
    private: json['private'] as bool,
    shareKey: json['shared_key'] as String?,
    links: (json['links'] as Map<String, dynamic>)
        .let((it) => CollectionLinks.fromJson(it)),
  );
}