when method

void when({
  1. required void onIndoorLevel(
    1. MasstransitIndoorLevel value
    ),
  2. required void onConnector(
    1. MasstransitConnector value
    ),
})

Applies the passed function to the variant value.

Implementation

void when({
  required void Function(MasstransitIndoorLevel value) onIndoorLevel,
  required void Function(MasstransitConnector value) onConnector,
}) {
  if (_value is MasstransitIndoorLevel) {
    return onIndoorLevel(_value as MasstransitIndoorLevel);
  }
  if (_value is MasstransitConnector) {
    return onConnector(_value as MasstransitConnector);
  }
  assert(false);
}