all method

bool all(
  1. bool predicate(
    1. R value
    )
)

Returns true if Left or returns the result of the application of the given predicate to the Right value.

Example

Right<int, int>(12).all((v) => v > 10); // Result: true
Right<int, int>(7).all((v) => v > 10);  // Result: false

Left<int, int>(12).all((v) => v > 10);  // Result: true
Left<int, int>(12).all((v) => v < 10);  // Result: true

Implementation

bool all(bool Function(R value) predicate) => _foldInternal(
      ifLeft: _const(true),
      ifRight: predicate,
    );