Line.fromJson constructor

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

Creates a new Line from a JSON object.

Implementation

factory Line.fromJson(Map<String, dynamic> json) {
  return Line(
    name: json[ApiFields.displayName] ?? '',
    startStationCode: json[ApiFields.startStationCode] ?? '',
    endStationCode: json[ApiFields.endStationCode] ?? '',
    internalDestination1: json[ApiFields.internalDestination1] ?? '',
    internalDestination2: json[ApiFields.internalDestination2] ?? '',
    lineCode: json[ApiFields.lineCode] ?? '',
  );
}