match<T> method

T match<T>({
  1. required T none(),
  2. required T fromAsset(
    1. VendorConfigFromAsset value
    ),
  3. required T fromFile(
    1. VendorConfigFromFile value
    ),
  4. required T fromString(
    1. VendorConfigFromString value
    ),
})

Implementation

T match<T>({
  required T Function() none,
  required T Function(VendorConfigFromAsset value) fromAsset,
  required T Function(VendorConfigFromFile value) fromFile,
  required T Function(VendorConfigFromString value) fromString,
}) {
  return switch (this._index) {
    0 => none(),
    1 => fromAsset(this._value as VendorConfigFromAsset),
    2 => fromFile(this._value as VendorConfigFromFile),
    3 => fromString(this._value as VendorConfigFromString),
    _ => throw NativeException("Unrecognized case index ${this._index}")
  };
}