match<T> method

T match<T>({
  1. required T eventCenter(
    1. GestureActionEventCenter value
    ),
  2. required T mapPosition(
    1. GestureActionMapPosition value
    ),
  3. required T targetGeoPoint(
    1. GestureActionTargetGeoPoint value
    ),
})

Implementation

T match<T>({
  required T Function(GestureActionEventCenter value) eventCenter,
  required T Function(GestureActionMapPosition value) mapPosition,
  required T Function(GestureActionTargetGeoPoint value) targetGeoPoint,
}) {
  return switch (this._index) {
    0 => eventCenter(this._value as GestureActionEventCenter),
    1 => mapPosition(this._value as GestureActionMapPosition),
    2 => targetGeoPoint(this._value as GestureActionTargetGeoPoint),
    _ => throw NativeException("Unrecognized case index ${this._index}")
  };
}