Result<T, E> class

An object that can contain either a successful result (of type T), or an error (of type E). Use the Result.ok and Result.error constructors to create these.

Constructors

Result({T? object, E? error})
const
Result.error(E error)
A failed result.
factory
Result.ok(T object)
A successful result.
factory

Properties

error → E?
final
hashCode int
The hash code for this object.
no setterinherited
hasObject bool
no setter
object → T?
final
ok bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
transform<X>(Result<X, E> transformer(T e)) Result<X, E>
Transforms a Result<T, E> into a Result<X, E> through transformer. If the Result this is called on has an error, it will be passed on, and if it is ok then the transformer will be applied.

Operators

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