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.fail(ResultError error)
-
Create fail
Result
with reason -
Result.fails(List<
ResultError> errors) -
Create fail
Result
with reason - Result.success()
-
Create success
Result
with valueconst - Result.withError(ResultError error)
-
Create fail
Result
with reason - Result.withErrorMessage(String message)
-
Result.withErrors(List<
ResultError> errors) -
Create fail
Result
with reason - Result.withException(Exception exception)
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(
ResultError error) → void - Add another error
-
addAll(
List< ResultError> 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