Dragon.fromJson constructor

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

Implementation

Dragon.fromJson(Map<String, dynamic> json) {
  _heatShield = (json['heat_shield'] != null)
      ? HeatShield.fromJson(json['heat_shield'])
      : throw ArgumentError('heat_shield cannot be null');

  _launchPayloadMass = (json['launch_payload_mass'] != null)
      ? LaunchPayloadMass.fromJson(json['launch_payload_mass'])
      : throw ArgumentError('launch_payload_mass cannot be null');

  _launchPayloadVol = (json['launch_payload_vol'] != null)
      ? LaunchPayloadVol.fromJson(json['launch_payload_vol'])
      : throw ArgumentError('launch_payload_vol cannot be null');

  _returnPayloadMass = (json['return_payload_mass'] != null)
      ? LaunchPayloadMass.fromJson(json['return_payload_mass'])
      : throw ArgumentError('return_payload_mass cannot be null');

  _returnPayloadVol = (json['return_payload_vol'] != null)
      ? LaunchPayloadVol.fromJson(json['return_payload_vol'])
      : throw ArgumentError('return_payload_vol cannot be null');

  _pressurizedCapsule = (json['pressurized_capsule'] != null)
      ? PressurizedCapsule.fromJson(json['pressurized_capsule'])
      : throw ArgumentError('pressurized_capsule cannot be null');

  _trunk = (json['trunk'] != null)
      ? Trunk.fromJson(json['trunk'])
      : throw ArgumentError('trunk cannot be null');

  _heightWTrunk = (json['height_w_trunk'] != null)
      ? HeightWTrunk.fromJson(json['height_w_trunk'])
      : throw ArgumentError('height_w_trunk cannot be null');

  _diameter = (json['diameter'] != null)
      ? Diameter.fromJson(json['diameter'])
      : throw ArgumentError('diameter cannot be null');

  _firstFlight = json['first_flight'];
  _flickrImages = json['flickr_images'];
  _name = json['name'];
  _type = json['type'];
  _active = json['active'];
  _crewCapacity = json['crew_capacity'];
  _sidewallAngleDeg = json['sidewall_angle_deg'];
  _orbitDurationYr = json['orbit_duration_yr'];
  _dryMassKg = json['dry_mass_kg'];
  _dryMassLb = json['dry_mass_lb'];
  if (json['thrusters'] != null) {
    _thrusters = List<Thrusters>.from(
        json['thrusters'].map((x) => Thrusters.fromJson(x)));
  } else {
    _thrusters = [];
  }
  _wikipedia = json['wikipedia'];
  _description = json['description'];
  _id = json['id'];
}