asStringOrThrow method

String asStringOrThrow()

Returns the picked value as String representation; only throws a PickException when the value is null or isAbsent.

Parses the picked value as String. If the value is not already a String its Object.toString() will be called. This means that this method works for int, double and any other Object.

Implementation

String asStringOrThrow() {
  withContext(
    requiredPickErrorHintKey,
    'Use asStringOrNull() when the value may be null/absent at some point (String?).',
  );
  return _parse();
}