SolDay.fromJson constructor

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

Factory constructor to create a SolDay instance from a JSON object

Implementation

factory SolDay.fromJson(Map<String, dynamic> json) {
  return SolDay(
    // Parsing the Sol number
    sol: json['sol'],

    // Parsing the Earth date
    earthDate: DateTime.parse(json['earth_date']),

    // Parsing the total photos
    totalPhotos: json['total_photos'],

    // Parsing the list of cameras
    cameras: List<String>.from(json['cameras']),
  );
}