filter method

  1. @override
Option<T> filter(
  1. bool predicate(
    1. T self
    )
)
override

Returns None if the option is None, otherwise calls predicate with the wrapped value and returns Some(t) if predicate returns true (where t is the wrapped value), and

Implementation

@override
Option<T> filter(bool Function(T self) predicate) {
  if (predicate(v)) {
    return this;
  }
  return None;
}