Result class
Result
is an object indicating success or failure of an operation
- Implementers
Constructors
-
Result({required bool isSuccess, List<
ResultError> errors = const []}) -
const
- Result.failWith(Object reason)
-
Result with fail reason
factory
- Result.success()
-
Create success
Result
with valueconst - Result.trySync(Result func(), {Result onError(dynamic e)?, void onFinally()?})
-
Wrapped on try/catch
factory
Properties
- error → ResultError?
-
no setter
- errorMessage → String
-
The reason why operation has been failed
no setter
-
errors
→ List<
ResultError> -
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isFail → bool
-
Returns whether the
Result
is failno setter - isSuccess → bool
-
Returns whether the
Result
is successfinal - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
Object reason) → void - Add another error
-
addAll(
List< Object> errors) → void - Add other errors
-
contains<
T extends ResultError> () → bool - Contains the Result a error or not
-
fold(
{required dynamic onFail(List< ResultError> errors), required dynamic onSuccess()}) → void -
Fold the
result
-
get<
T extends ResultError> () → T? - try get the specific error
-
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.
override