ok<T> static method

T ok<T>(
  1. Result<T> result, {
  2. String? reason,
})

Asserts result is a Ok and returns its value.

Implementation

static T ok<T>(Result<T> result, {String? reason}) => result.match(
  ok: (T value) => value,
  err: (Problem problem) =>
      throw AuthAssertionError(reason ?? 'expected Ok but got Err($problem)'),
);