Rocket.fromJson constructor

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

Implementation

factory Rocket.fromJson(Map<String, dynamic> json) {
  return Rocket(
    height: Diameter.fromJson(json['height']),
    diameter: Diameter.fromJson(json['diameter']),
    mass: Mass.fromJson(json['mass']),
    firstStage: FirstStage.fromJson(json['first_stage']),
    secondStage: SecondStage.fromJson(json['second_stage']),
    engines: Engines.fromJson(json['engines']),
    landingLegs: LandingLegs.fromJson(json['landing_legs']),
    payloadWeights: (json['payload_weights'] as List)
        .map((payloadWeight) => PayloadWeights.fromJson(payloadWeight))
        .toList(),
    flickrImages: (json['flickr_images'] as List).cast<String>(),
    name: json['name'],
    type: json['type'],
    active: json['active'],
    stages: json['stages'],
    boosters: json['boosters'],
    costPerLaunch: json['cost_per_launch'],
    successRatePct: json['success_rate_pct'],
    firstFlight: json['first_flight'],
    country: json['country'],
    company: json['company'],
    wikipedia: json['wikipedia'],
    description: json['description'],
    id: json['id'],
  );
}