Case constructor

Case(
  1. Logic expression,
  2. List<CaseItem> items, {
  3. List<Conditional>? defaultItem,
  4. ConditionalType conditionalType = ConditionalType.none,
})

Whenever an item in items matches expression, it will be executed.

If none of items match, then defaultItem is executed.

Implementation

Case(this.expression, this.items,
    {List<Conditional>? defaultItem,
    this.conditionalType = ConditionalType.none})
    : _defaultItem = defaultItem {
  for (final item in items) {
    if (item.value.width != expression.width) {
      throw PortWidthMismatchException.equalWidth(expression, item.value);
    }
  }
}