testResult<T> function

Result<T> testResult<T>(
  1. bool test(
    1. Result<T>
    ),
  2. Result<T> result,
  3. String failedTestMsg
)

Calls test(result) and returns result as is if test return true. Otherwise returns Err(ArgumentError(failedTestMsg)).

Implementation

Result<T> testResult<T>(bool Function(Result<T>) test, Result<T> result,
        String failedTestMsg) =>
    test(result) ? result : Err(ArgumentError(failedTestMsg));