Result<T> class
sealed
Utility class that simplifies handling errors.
Return a Result from a function to indicate success or failure.
A Result is either an Ok with a value of type T
or an Error with an Exception.
Use Result.ok to create a successful result with a value of type T
.
Use Result.error to create an error result with an Exception.
Constructors
- Result.error(Failure error)
-
Create an instance of Result containing an error
factory
- Result.ok(T value)
-
Creates an instance of Result containing a value
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited