addIfNonNull method

bool addIfNonNull(
  1. E? element
)

Adds the element to this set and returns true if it is not null.

{}.addIfNonNull(1); // {1}, true

{}.addIfNonNull(null); // {}, false

Implementation

bool addIfNonNull(E? element) => element != null && add(element);