match<T> method
T
match<T>({
- required T bicycle(
- BicycleBriefRouteInfo value
- required T car(
- CarBriefRouteInfo value
- required T pedestrian(
- PedestrianBriefRouteInfo value
- required T publicTransport(
- PublicBriefRouteInfo value
- required T scooter(
- ScooterBriefRouteInfo value
Implementation
T match<T>({
required T Function(BicycleBriefRouteInfo value) bicycle,
required T Function(CarBriefRouteInfo value) car,
required T Function(PedestrianBriefRouteInfo value) pedestrian,
required T Function(PublicBriefRouteInfo value) publicTransport,
required T Function(ScooterBriefRouteInfo value) scooter,
}) {
return switch (this._index) {
0 => bicycle(this._value as BicycleBriefRouteInfo),
1 => car(this._value as CarBriefRouteInfo),
2 => pedestrian(this._value as PedestrianBriefRouteInfo),
3 => publicTransport(this._value as PublicBriefRouteInfo),
4 => scooter(this._value as ScooterBriefRouteInfo),
_ => throw NativeException("Unrecognized case index ${this._index}")
};
}