elseDo method

void elseDo(
  1. void callback()
)

Defines the callback that is called when the result wasn't matched by any of the earlier checks. Example:

someResult.check
 ..ifErr((SomeError err) => print('This never happens'))
 ..elseDo(() => print('This text is printed!'));

Implementation

void elseDo(void Function() callback) {
  if (!_hasMatched) {
    callback();
  }
}