match<T> method
T
match<T>({
- required T bicycleStart(
- BicycleInstructionStart value
- required T bicycleFinish(
- BicycleInstructionFinish value
- required T bicycleCrossroad(),
- required T carStart(
- CarInstructionStart value
- required T carFinish(
- CarInstructionFinish value
- required T carCrossroad(
- CarInstructionCrossroad value
- required T carRoundabout(
- CarInstructionRoundabout value
- required T carUturn(
- CarInstructionUTurn value
- required T pedestrianStart(),
- required T pedestrianFinish(),
- required T pedestrianCrossroad(),
- required T pedestrianIndoorFloorChange(),
- required T pedestrianIndoorEnter(),
- required T pedestrianIndoorExit(),
- required T scooterStart(
- ScooterInstructionStart value
- required T scooterFinish(
- ScooterInstructionFinish value
- required T scooterCrossroad(),
Implementation
T match<T>({
required T Function(BicycleInstructionStart value) bicycleStart,
required T Function(BicycleInstructionFinish value) bicycleFinish,
required T Function(BicycleInstructionCrossroad value) bicycleCrossroad,
required T Function(CarInstructionStart value) carStart,
required T Function(CarInstructionFinish value) carFinish,
required T Function(CarInstructionCrossroad value) carCrossroad,
required T Function(CarInstructionRoundabout value) carRoundabout,
required T Function(CarInstructionUTurn value) carUturn,
required T Function(PedestrianInstructionStart value) pedestrianStart,
required T Function(PedestrianInstructionFinish value) pedestrianFinish,
required T Function(PedestrianInstructionCrossroad value) pedestrianCrossroad,
required T Function(PedestrianInstructionIndoorFloorChange value) pedestrianIndoorFloorChange,
required T Function(PedestrianInstructionIndoorEnter value) pedestrianIndoorEnter,
required T Function(PedestrianInstructionIndoorExit value) pedestrianIndoorExit,
required T Function(ScooterInstructionStart value) scooterStart,
required T Function(ScooterInstructionFinish value) scooterFinish,
required T Function(ScooterInstructionCrossroad value) scooterCrossroad,
}) {
return switch (this._index) {
0 => bicycleStart(this._value as BicycleInstructionStart),
1 => bicycleFinish(this._value as BicycleInstructionFinish),
2 => bicycleCrossroad(this._value as BicycleInstructionCrossroad),
3 => carStart(this._value as CarInstructionStart),
4 => carFinish(this._value as CarInstructionFinish),
5 => carCrossroad(this._value as CarInstructionCrossroad),
6 => carRoundabout(this._value as CarInstructionRoundabout),
7 => carUturn(this._value as CarInstructionUTurn),
8 => pedestrianStart(this._value as PedestrianInstructionStart),
9 => pedestrianFinish(this._value as PedestrianInstructionFinish),
10 => pedestrianCrossroad(this._value as PedestrianInstructionCrossroad),
11 => pedestrianIndoorFloorChange(this._value as PedestrianInstructionIndoorFloorChange),
12 => pedestrianIndoorEnter(this._value as PedestrianInstructionIndoorEnter),
13 => pedestrianIndoorExit(this._value as PedestrianInstructionIndoorExit),
14 => scooterStart(this._value as ScooterInstructionStart),
15 => scooterFinish(this._value as ScooterInstructionFinish),
16 => scooterCrossroad(this._value as ScooterInstructionCrossroad),
_ => throw NativeException("Unrecognized case index ${this._index}")
};
}