Result<ERR extends Object, OK extends Object> class abstract

Implementers

Constructors

Result()
const

Properties

check ResultChecker<ERR, OK>
Creates a checker for this result. Can be used to check if the result is an error or an ok value. Example:
no setter
err → ERR
Getter that will cast the result as an error. If the result is ok, it will throw an exception. You MUST CHECK if the result is an error before calling this getter.
no setter
hashCode int
The hash code for this object.
no setterinherited
isErr bool
Getter that will check if this result is an error.
no setter
isOk bool
Getter that will check if this result is ok.
no setter
ok → OK
Getter that will cast the result as ok. If the result is an error, it will throw an exception. You MUST CHECK if the result is ok before calling this getter.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

map<ERR_OUT extends Object, OK_OUT extends Object>({required Result<ERR_OUT, OK_OUT> onErr(ERR), required Result<ERR_OUT, OK_OUT> onOk(OK)}) Result<ERR_OUT, OK_OUT>
Transforms this result into another result. Takes two callback functions: one for the error case and one for the ok case. Each callback function must return the same type of result. Example:
mapFuture<ERR_OUT extends Object, OK_OUT extends Object>({required Future<Result<ERR_OUT, OK_OUT>> onErr(ERR), required Future<Result<ERR_OUT, OK_OUT>> onOk(OK)}) Future<Result<ERR_OUT, OK_OUT>>
Transforms this result into another result. Takes two callback functions: one for the error case and one for the ok case. Each callback function must return the same type of result. Example:
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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