getValueOrThrow method

T getValueOrThrow()

Gets the value from the parse operation if it was successful, or throws an exception indicating the parse failure otherwise.

This method is exactly equivalent to fetching the value property, but more explicit in terms of throwing an exception on failure.

Returns: The result of the parsing operation if it was successful.

Implementation

T getValueOrThrow() {
  if (_errorProvider == null) {
    return _value;
  }
  throw _errorProvider!();
}