match<T> method

T match<T>({
  1. required T objectHandler(
    1. SuggestObjectHandler? value
    ),
  2. required T performSearchHandler(
    1. PerformSearchHandler? value
    ),
  3. required T incompleteTextHandler(
    1. IncompleteTextHandler? value
    ),
})

Implementation

T match<T>({
  required T Function(SuggestObjectHandler? value) objectHandler,
  required T Function(PerformSearchHandler? value) performSearchHandler,
  required T Function(IncompleteTextHandler? value) incompleteTextHandler,
}) {
  return switch (this._index) {
    0 => objectHandler(this._value as SuggestObjectHandler?),
    1 => performSearchHandler(this._value as PerformSearchHandler?),
    2 => incompleteTextHandler(this._value as IncompleteTextHandler?),
    _ => throw NativeException("Unrecognized case index ${this._index}")
  };
}