mapIf<U> method

  1. @useResult
U? mapIf<U>(
  1. bool p(
    1. T
    ),
  2. U f(
    1. T
    )
)

Maps over the value if it is not null and satisfies the given predicate.

Implementation

@useResult
U? mapIf<U>(bool Function(T) p, U Function(T) f) =>
    this != null && p(this as T) ? f(this as T) : null;