RouteProgressEvent.fromJson constructor

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

Implementation

RouteProgressEvent.fromJson(Map<String, dynamic> json) {
  currentLocation = json['location'] == null
      ? null
      : CurrentLocation.fromJson(json['location'] as Map<String, dynamic>);
  snappedLocation = json['snappedLocation'] == null
      ? null
      : CurrentLocation.fromJson(
          json['snappedLocation'] as Map<String, dynamic>);
  currentModifier = json['currentModifier'];
  currentModifierType = json['currentModifierType'];
  distanceToNextTurn = json['distanceToNextTurn'];
  isProgressEvent = json['arrived'] != null;
  arrived = json['arrived'] == null ? false : json['arrived'] as bool?;
  distanceRemaining = isNullOrZero(json['distanceRemaining'])
      ? 0.0
      : json["distanceRemaining"] + .0;
  durationRemaining = isNullOrZero(json['durationRemaining'])
      ? 0.0
      : json["durationRemaining"] + .0;
  distanceTraveled = isNullOrZero(json['distanceTraveled'])
      ? 0.0
      : json["distanceTraveled"] + .0;
  currentLegDistanceTraveled =
      isNullOrZero(json['currentLegDistanceTraveled'])
          ? 0.0
          : json["currentLegDistanceTraveled"] + .0;
  currentLegDistanceRemaining =
      isNullOrZero(json['currentLegDistanceRemaining'])
          ? 0.0
          : json["currentLegDistanceRemaining"] + .0;
  currentStepInstruction = json['currentStepInstruction'];
  currentLeg = json['currentLeg'] == null
      ? null
      : RouteLeg.fromJson(json['currentLeg'] as Map<String, dynamic>);
  priorLeg = json['priorLeg'] == null
      ? null
      : RouteLeg.fromJson(json['priorLeg'] as Map<String, dynamic>);
  remainingLegs = (json['remainingLegs'] as List?)
      ?.map((e) =>
          e == null ? null : RouteLeg.fromJson(e as Map<String, dynamic>))
      .cast<RouteLeg>()
      .toList();
  legIndex = json['legIndex'];
  stepIndex = json['stepIndex'];
}