Option<R>.fromPredicate constructor

Option<R>.fromPredicate(
  1. R value,
  2. bool predicate(
    1. R r
    )
)

Implementation

factory Option.fromPredicate(R value, bool Function(R r) predicate) {
  if (predicate(value)) return Some(value);
  return const None();
}