ResultQuery<T, E> extension
Asking a Result what it holds, and taking the value out.
final passed = const Ok<int, String>(90).isOkAnd((score) => score >= 50);
final score = const Ok<int, String>(90).ok(); // Some(90)
- on
-
- Result<
T, E>
- Result<
Methods
-
err(
) → Option< E> -
Available on Result<
The error as Some, or None for an Ok.T, E> , provided by the ResultQuery extension -
expect(
String message) → T -
Available on Result<
Returns the successful value, or throwsT, E> , provided by the ResultQuery extensionmessagefor an Err. -
expectErr(
String message) → E -
Available on Result<
Returns the error, or throwsT, E> , provided by the ResultQuery extensionmessagefor an Ok. -
isErrAnd(
bool predicate(E error)) → bool -
Available on Result<
Whether the result failed and its error satisfiesT, E> , provided by the ResultQuery extensionpredicate. -
isOkAnd(
bool predicate(T value)) → bool -
Available on Result<
Whether the result succeeded and its value satisfiesT, E> , provided by the ResultQuery extensionpredicate. -
ok(
) → Option< T> -
Available on Result<
The successful value as Some, or None for an Err.T, E> , provided by the ResultQuery extension -
unwrap(
) → T -
Available on Result<
Returns the successful value, or throws for an Err.T, E> , provided by the ResultQuery extension -
unwrapErr(
) → E -
Available on Result<
Returns the error, or throws for an Ok.T, E> , provided by the ResultQuery extension