vehicleRegistration property

VehicleRegistration? get vehicleRegistration

Returns the vehicle registration profile for the current transport mode.

Extracts the relevant vehicle profile (CarProfile, TruckProfile, or ElectricBikeProfile) based on the selected transportMode. Returns null for pedestrian, public, and shared vehicle modes or when no profile is configured.

Implementation

VehicleRegistration? get vehicleRegistration {
  switch (transportMode) {
    case RouteTransportMode.car:
      return carProfile;
    case RouteTransportMode.lorry:
      return truckProfile;
    case RouteTransportMode.bicycle:
      final ElectricBikeType ebikeType =
          bikeProfile?.eProfile?.type ?? ElectricBikeType.none;
      if (ebikeType != ElectricBikeType.none) {
        return bikeProfile?.eProfile;
      }
      return null;
    case RouteTransportMode.pedestrian:
      return null;
    case RouteTransportMode.public:
      return null;
    case RouteTransportMode.sharedVehicles:
      return null;
  }
}