when method

T? when(
  1. bool condition
)

Implementation

T? when(bool condition) {
  if (condition) {
    return this;
  }
  return null;
}