GFailure<T, E> class final

A failed GResult holding an error.

Inheritance
Available extensions

Constructors

GFailure(E error)
Creates a GFailure instance with error.
const

Properties

error → E
The failure error.
final
errorOrNull → E?
Returns the failure error if present, or null.
no setterinherited
hashCode → int
The hash code for this object.
no setteroverride
isFailure → bool
Returns true if this result is GFailure.
no setterinherited
isSuccess → bool
Returns true if this result is GSuccess.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → T?
Returns the success value if present, or null.
no setterinherited

Methods

filter(bool predicate(T value), {required E orElse(T value)}) → GResult<T, E>
Demotes a success that fails predicate into a failure built by orElse.
inherited
flatMap<R>(GResult<R, E> fn(T value)) → GResult<R, E>
Binds a function that returns a GResult.
inherited
flatMapAsync<R>(FutureOr<GResult<R, E>> transform(T value)) → Future<GResult<R, E>>

Available on GResult<T, E>, provided by the GmanaResultX extension

Asynchronously chains a success into another GResult.
fold<R>({required R onSuccess(T value), required R onFailure(E error)}) → R
Collapses both branches into a single value of type R.
inherited
getOrElse(T fallback) → T
Returns the success value, or fallback if this is a GFailure.
inherited
getOrElseGet(T fallback(E error)) → T

Available on GResult<T, E>, provided by the GmanaResultX extension

Returns the success value, or lazily creates a fallback from the error.
getOrThrow() → T
Returns the success value, or throws the failure error.
inherited
inspectFailure(void action(E error)) → GResult<T, E>

Available on GResult<T, E>, provided by the GmanaResultX extension

Runs action for a GFailure, then returns this result unchanged.
inspectSuccess(void action(T value)) → GResult<T, E>

Available on GResult<T, E>, provided by the GmanaResultX extension

Runs action for a GSuccess, then returns this result unchanged.
map<R>(R fn(T value)) → GResult<R, E>
Transforms the success value using fn.
inherited
mapAsync<R>(FutureOr<R> transform(T value)) → Future<GResult<R, E>>

Available on GResult<T, E>, provided by the GmanaResultX extension

Asynchronously transforms a success value using transform.
mapBoth<R, F>({required R onSuccess(T value), required F onFailure(E error)}) → GResult<R, F>
Transforms whichever branch is present.
inherited
mapError<F>(F fn(E error)) → GResult<T, F>
Transforms the error using fn.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recover(T transform(E error)) → GResult<T, E>

Available on GResult<T, E>, provided by the GmanaResultX extension

Converts a GFailure into a GSuccess using transform.
recoverWith(GResult<T, E> transform(E error)) → GResult<T, E>

Available on GResult<T, E>, provided by the GmanaResultX extension

Replaces a GFailure with the result returned by transform.
swap() → GResult<E, T>
Exchanges the success and failure branches.
inherited
toEither() → Either<E, T>

Available on GResult<T, E>, provided by the GmanaResultToEitherX extension

Converts this GResult to an Either, mapping GSuccess to Right and GFailure to Left.
toString() → String
A string representation of this object.
override
when<R>({required R onSuccess(T value), required R onFailure(E error)}) → R
Pattern-matches over the result.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override