toJson method

  1. @override
Map<String, dynamic> toJson()
override

Returns the json representation of this model in the unsplash api.

Implementation

@override
Map<String, dynamic> toJson() {
  return <String, dynamic>{
    'id': id,
    'slug': slug,
    'title': title,
    'description': description,
    'published_at': publishedAt.toIso8601String(),
    'updated_at': updatedAt.toIso8601String(),
    'starts_at': startsAt.toIso8601String(),
    'ends_at': endsAt?.toIso8601String(),
    'featured': featured,
    'total_photos': totalPhotos,
    'links': links.toJson(),
    'status': status,
    'owners': owners.map((it) => it.toJson()).toList(),
    'top_contributors': topContributors?.map((it) => it.toJson()).toList(),
    'cover_photo': coverPhoto.toJson(),
  };
}