isOkAnd abstract method

bool isOkAnd(
  1. bool f(
    1. T value
    )
)

Returns true if the result is Ok and the value matches the predicate f

Examples

Result<int, String> x = Ok(9);
expect(x.isOkAnd((int val) => val > 5), true);

expect(x.isOkAnd((int val) => val < 5), false);

Result<int, String> y = Err('An unexpected error occured');
expect(x.isOkAnd((_) => true), false);

Implementation

bool isOkAnd(bool Function(T value) f);