containsErr method

  1. @override
bool containsErr(
  1. Object? x
)
override

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

@override
bool containsErr(Object? x) => x == e;