when method

void when({
  1. required void onDirectionSignToponym(
    1. DrivingDirectionSignToponym value
    ),
  2. required void onDirectionSignRoad(
    1. DrivingDirectionSignRoad value
    ),
  3. required void onDirectionSignExit(
    1. DrivingDirectionSignExit value
    ),
  4. required void onDirectionSignIcon(
    1. DrivingDirectionSignIcon value
    ),
})

Applies the passed function to the variant value.

Implementation

void when({
  required void Function(DrivingDirectionSignToponym value)
      onDirectionSignToponym,
  required void Function(DrivingDirectionSignRoad value) onDirectionSignRoad,
  required void Function(DrivingDirectionSignExit value) onDirectionSignExit,
  required void Function(DrivingDirectionSignIcon value) onDirectionSignIcon,
}) {
  if (_value is DrivingDirectionSignToponym) {
    return onDirectionSignToponym(_value as DrivingDirectionSignToponym);
  }
  if (_value is DrivingDirectionSignRoad) {
    return onDirectionSignRoad(_value as DrivingDirectionSignRoad);
  }
  if (_value is DrivingDirectionSignExit) {
    return onDirectionSignExit(_value as DrivingDirectionSignExit);
  }
  if (_value is DrivingDirectionSignIcon) {
    return onDirectionSignIcon(_value as DrivingDirectionSignIcon);
  }
  assert(false);
}