operator ~ method

dynamic operator ~()

Returns the value if it is TOk or error if it is TErr Convinient operator to get the value from the result, Usage:

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

class CustomError extends TError {}

final res = TResult<int>.from(CustomError());
CustomError err = ~res;
assert(err is CustomError);

Implementation

operator ~() => ~this;