match<T> method

T match<T>({
  1. required T geoPoint(
    1. GeoPoint value
    ),
  2. required T geoPointWithElevation(
    1. GeoPointWithElevation value
    ),
})

Implementation

T match<T>({
  required T Function(GeoPoint value) geoPoint,
  required T Function(GeoPointWithElevation value) geoPointWithElevation,
}) {
  return switch (this._index) {
    0 => geoPoint(this._value as GeoPoint),
    1 => geoPointWithElevation(this._value as GeoPointWithElevation),
    _ => throw NativeException("Unrecognized case index ${this._index}")
  };
}