Success<T> class

Represents a successful result

Inheritance
Available extensions

Constructors

Success(T data)
Creates a successful result with the given data
const

Properties

data → T
The successful data
final
failure Failure?
Returns the failure if failed, null otherwise
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isFailure bool
Returns true if the result is a failure
no setterinherited
isSuccess bool
Returns true if the result is successful
no setterinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
value → T?
Returns the success value if successful, null otherwise
no setterinherited

Methods

map<R>(R transform(T)) Result<R>
Transforms the success value using the provided function
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFailure(void action(Failure)) → void
Executes a function if the result is a failure
inherited
onSuccess(void action(T)) → void
Executes a function if the result is successful
inherited
toString() String
A string representation of this object.
inherited
unwrap() → T

Available on Result<T>, provided by the ResultExtensions extension

Returns the value if successful, throws the failure message otherwise
unwrapOr(T defaultValue) → T

Available on Result<T>, provided by the ResultExtensions extension

Returns the value if successful, the provided default value otherwise
unwrapOrElse(T defaultValue(Failure)) → T

Available on Result<T>, provided by the ResultExtensions extension

Returns the value if successful, the result of the provided function otherwise

Operators

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