where abstract method

  1. @useResult
Option<T> where(
  1. bool condition(
    1. T value
    )
)

Returns a Some of the original value if this is a Some and its contained value satisfies condition, or None otherwise.

Examples

// prints "Some(2)"
print(const Some(2).where((value) => true));

// prints "None"
print(const Some(2).where((value) => false));

Implementation

@useResult
Option<T> where(bool Function(T value) condition);