operator ~ method

dynamic operator ~()

Returns the value if it is IOk or error if it is IErr Convinient operator to get the inner value from the result, Usage:

final res = IResult<int>.from(1);
int val = ~res;
assert(val == 1);

Error Usage:

enum TestErrorType implements IErrorType {
 error,
}

final res = IResult<int>.from(TestErrorType.error);
String err = ~res;
assert(err is TestErrorType);

Implementation

operator ~() => ~this;