when method
void
when({
- required void onManoeuvreBalloon(
- ManoeuvreBalloon value
- required void onManoeuvreWithLaneSignBalloon(),
- required void onLaneSignBalloon(
- LaneSignBalloon value
- required void onRouteSummaryBalloon(
- RouteSummaryBalloon value
- required void onAlternativeBalloon(
- AlternativeBalloon value
Applies the passed function to the variant value.
Implementation
void when({
required void Function(ManoeuvreBalloon value) onManoeuvreBalloon,
required void Function(ManoeuvreWithLaneSignBalloon value)
onManoeuvreWithLaneSignBalloon,
required void Function(LaneSignBalloon value) onLaneSignBalloon,
required void Function(RouteSummaryBalloon value) onRouteSummaryBalloon,
required void Function(AlternativeBalloon value) onAlternativeBalloon,
}) {
if (_value is ManoeuvreBalloon) {
return onManoeuvreBalloon(_value as ManoeuvreBalloon);
}
if (_value is ManoeuvreWithLaneSignBalloon) {
return onManoeuvreWithLaneSignBalloon(
_value as ManoeuvreWithLaneSignBalloon);
}
if (_value is LaneSignBalloon) {
return onLaneSignBalloon(_value as LaneSignBalloon);
}
if (_value is RouteSummaryBalloon) {
return onRouteSummaryBalloon(_value as RouteSummaryBalloon);
}
if (_value is AlternativeBalloon) {
return onAlternativeBalloon(_value as AlternativeBalloon);
}
assert(false);
}