when method

T? when(
  1. Object? condition
)

Returns this if condition evaluates to true, otherwise null.

condition can be:

  • bool
  • bool Function() (lazy)
  • anything else → false

Implementation

T? when(Object? condition) => _evalCondition(condition) ? this : null;