filter method
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
// None if predicate returns false
@pragma("vm:prefer-inline")
Option<T> filter(bool Function(T) predicate) {
if (v == null) {
return None;
} else {
if (predicate(v!)) {
return Some(v!);
}
return None;
}
}