operator ~ method

() operator ~()

Shortcut to call Result.unwrap().

Warning: This is an unsafe operation. A ResultError will be thrown if this operator is used on an Err value. You can take advantage of this safely via catchResult/catchResultAsync.

Result<(), String> err = catchResultAsync(() async {
  ~await failableOperation1();
  ~failableOperation2();

  return Ok(());
});

if (err case Err(value: String error)) {
  print(error);
  return;
}

See also: Rust: Result::unwrap()

Implementation

() operator ~() => unwrap();