ParseResult<T> class

The result of a parse operation.

T: The type which was parsed, such as a LocalDateTime.

Annotations
  • @immutable

Properties

error Error
Gets an exception indicating the cause of the parse failure.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
success bool
Indicates whether the parse operation was successful.
no setter
value → T
Gets the value from the parse operation if it was successful, or throws an exception indicating the parse failure otherwise.
no setter

Methods

convert<TTarget>(TTarget projection(T)) ParseResult<TTarget>
Converts this result to a new target type, either by executing the given projection for a success result, or propagating the exception provider for failure.
convertError<TTarget>() ParseResult<TTarget>
Converts this result to a new target type by propagating the exception provider. This parse result must already be an error result.
getValueOrThrow() → T
Gets the value from the parse operation if it was successful, or throws an exception indicating the parse failure otherwise.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
TryGetValue(T failureValue) → T
Returns the success value, and sets the out parameter to either the specified failure value of T or the successful parse result value.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

forError<T>(Error errorProvider()) ParseResult<T>
Produces a ParseResult which represents a failed parsing operation.
forValue<T>(T value) ParseResult<T>
Produces a ParseResult which represents a successful parse operation.