contains method

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

Returns true if the result is an Ok (success) value containing the given value.

Examples

Basic usage:

Result<int, String> x = Ok(2);
expect(x.contains(2), true);

Result<int, String> x = Ok(3);
expect(x.contains(2), false);

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

Implementation

@override
bool contains(Object? x) => false;