Ok<ERR extends Object, OK extends Object> class

Inheritance

Constructors

Ok(OK val)
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 setterinherited
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 setterinherited
hashCode int
The hash code for this object.
no setterinherited
isErr bool
Getter that will check if this result is an error.
no setterinherited
isOk bool
Getter that will check if this result is ok.
no setterinherited
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 setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
val → OK
final

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:
inherited
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:
inherited
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