addIfNotNull method

Set<E> addIfNotNull(
  1. E? element
)

Returns a new set with element added if it's not null.

Implementation

Set<E> addIfNotNull(E? element) {
  if (element == null) return this;
  return {...this, element};
}