ShuttleRoute.fromJson constructor

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

Implementation

ShuttleRoute.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  name = json['name'];
  description = json['description'];
  enabled = json['enabled'];
  color = Color(int.parse(json['color'].toString().replaceAll('#', '0xff')));
  width = json['width'];
  stopIds = json['stop_ids'].cast<int>();
  created = json['created'];
  updated = json['updated'];
  if (json['points'] != null) {
    points = new List<Point>();
    json['points'].forEach((v) {
      points.add(new Point.fromJson(v));
    });
  }
  active = json['active'];
  if (json['schedule'] != null) {
    schedule = new List<Schedule>();
    json['schedule'].forEach((v) {
      schedule.add(new Schedule.fromJson(v));
    });
  }
}