Try<Success, Failure extends Exception> class

Constructors

Try.failure(Failure? failure)
Try.success(Success? success)

Properties

failure → Failure?
final
hashCode int
The hash code for this object.
no setterinherited
isFailure bool
no setter
isSuccess bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
success → Success?
final

Methods

exceptionOrNull() → Failure?
Returns the encapsulated Throwable exception if this instance represents failure or null if it is success. */
flatMap<R>(Try<R, Failure> transform(Success value)) Try<R, Failure>
getOrElse(Success onFailure(Failure)) → Success
getOrNull() → Success?
Returns the encapsulated value if this instance represents success or null if it is failure. */
getOrThrow() → Success
Returns the encapsulated value if this instance represents success or throws the encapsulated Throwable exception if it is failure.
map<R>(R transform(Success value)) Try<R, Failure>
Returns the encapsulated result of the given transform function applied to the encapsulated value if this instance represents success or the original encapsulated Throwable exception if it is failure.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFailure(void action(Failure)) Try<Success, Failure>
Performs the given action on the encapsulated Throwable exception if this instance represents failure. Returns the original Try unchanged.
onSuccess(void action(Success)) Try<Success, Failure>
Performs the given action on the encapsulated value if this instance represents success. Returns the original Try unchanged.
toString() String
A string representation of this object.
override

Operators

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