match<T> method

T match<T>({
  1. required T logicalPixel(
    1. LogicalPixel value
    ),
  2. required T scale(
    1. ModelScale value
    ),
})

Implementation

T match<T>({
  required T Function(LogicalPixel value) logicalPixel,
  required T Function(ModelScale value) scale,
}) {
  return switch (this._index) {
    0 => logicalPixel(this._value as LogicalPixel),
    1 => scale(this._value as ModelScale),
    _ => throw NativeException("Unrecognized case index ${this._index}")
  };
}