match<T> method
T
match<T>({
- required T bicycle(),
- required T car(
- CarRouteSearchOptions value
- required T pedestrian(),
- required T publicTransport(),
- required T scooter(),
- required T taxi(
- TaxiRouteSearchOptions value
- required T truck(
- TruckRouteSearchOptions value
Implementation
T match<T>({
required T Function(BicycleRouteSearchOptions value) bicycle,
required T Function(CarRouteSearchOptions value) car,
required T Function(PedestrianRouteSearchOptions value) pedestrian,
required T Function(PublicTransportRouteSearchOptions value) publicTransport,
required T Function(ScooterRouteSearchOptions value) scooter,
required T Function(TaxiRouteSearchOptions value) taxi,
required T Function(TruckRouteSearchOptions value) truck,
}) {
return switch (this._index) {
0 => bicycle(this._value as BicycleRouteSearchOptions),
1 => car(this._value as CarRouteSearchOptions),
2 => pedestrian(this._value as PedestrianRouteSearchOptions),
3 => publicTransport(this._value as PublicTransportRouteSearchOptions),
4 => scooter(this._value as ScooterRouteSearchOptions),
5 => taxi(this._value as TaxiRouteSearchOptions),
6 => truck(this._value as TruckRouteSearchOptions),
_ => throw NativeException("Unrecognized case index ${this._index}")
};
}