inspect method

  1. @override
  2. @useResult
Ok<T, E> inspect(
  1. void inspect(
    1. T value
    )
)
override

Calls inspect with the contained value if this is an Ok.

Examples

// prints "2"
const Ok<int, String>(2).inspect(print);

// prints nothing
const Err<int, String>('error').inspect(print);

Implementation

@override
@useResult
Ok<T, E> inspect(void Function(T value) inspect) {
  inspect(value);

  return this;
}