inspect method

  1. @override
  2. @useResult
Some<T> inspect(
  1. void inspect(
    1. T value
    )
)
override

Calls inspect with the contained value if this is a Some.

Examples

// prints "2"
const Some(2).inspect(print);

// prints nothing
const None<int>().inspect(print);

Implementation

@override
@useResult
Some<T> inspect(void Function(T value) inspect) {
  inspect(value);

  return this;
}