when method

  1. @override
void when({
  1. Consume<S> success = Result._nothing,
  2. Consume<F> failure = Result._nothing,
})
override

Calls success if this is a Success, or failure if this is a Failure.

Success('s').when(success: print); // 's'

Failure('f').when(success: print); // nothing

Implementation

@override
void when({Consume<S> success = Result._nothing, Consume<F> failure = Result._nothing}) => success(this.success);