containsErr abstract method

bool containsErr(
  1. Object? x
)

Returns true if the result is an Err (failure) value containing the given value.

Examples

Basic usage:

Result<int, String> x = Ok(2);
expect(x.containsErr('Some error message'), false);

Result<int, String> x = Err('Some error message');
expect(x.contains('Some error message'), true);

Result<int, String> x = Err('Some other error message');
expect(x.contains('Some error message'), false);

Implementation

bool containsErr(Object? x);