toJson method

Map<String, dynamic> toJson()

Returns a JSON representation of this object.

Implementation

Map<String, dynamic> toJson() {
  Map<String, dynamic> json = {
    ApiFields.dateUpdated: timeOfLastUpdate.toIso8601String(),
    ApiFields.description: description,
    ApiFields.incidentId: incidentId,
    ApiFields.incidentType: incidentType,
  };

  if (_affectedLinesWasString) {
    json[ApiFields.linesAffected] = "${affectedLines.join('; ')};";
  } else {
    json[ApiFields.linesAffected] = affectedLines;
  }

  return json;
}