KtSet<T>.from constructor

KtSet<T>.from(
  1. [@nonNull Iterable<T> elements = const []]
)

Returns a new read-only set based on elements.

Implementation

factory KtSet.from([@nonNull Iterable<T> elements = const []]) {
  assert(() {
    if (elements == null) throw ArgumentError("elements can't be null");
    return true;
  }());
  if (elements.isEmpty) return EmptySet<T>();
  return DartSet(elements);
}