38 lines
968 B
Dart
38 lines
968 B
Dart
class Colonia {
|
|
const Colonia({
|
|
required this.id,
|
|
required this.nombre,
|
|
this.routeId,
|
|
this.horarioEstimado,
|
|
this.turno,
|
|
});
|
|
|
|
final String id;
|
|
final String nombre;
|
|
final String? routeId;
|
|
final String? horarioEstimado;
|
|
final String? turno;
|
|
|
|
factory Colonia.fromJson(Map<String, dynamic> json) {
|
|
final rawId =
|
|
json['id'] ??
|
|
json['routeId'] ??
|
|
json['route_id'] ??
|
|
json['nombre'] ??
|
|
json['name'];
|
|
final rawNombre = json['nombre'] ?? json['name'] ?? rawId;
|
|
|
|
return Colonia(
|
|
id: rawId?.toString() ?? rawNombre?.toString() ?? '',
|
|
nombre: rawNombre?.toString() ?? '',
|
|
routeId: (json['routeId'] ?? json['route_id'])?.toString(),
|
|
horarioEstimado:
|
|
(json['horario_estimado'] ??
|
|
json['horarioEstimado'] ??
|
|
json['schedule'])
|
|
?.toString(),
|
|
turno: (json['turno'] ?? json['shift'])?.toString(),
|
|
);
|
|
}
|
|
}
|