fromIterable<T, I> static method

ISet<T> fromIterable<T, I>(
  1. Iterable<I> iterable, {
  2. required Iterable<T>? mapper(
    1. I
    ),
  3. ConfigSet? config,
})

Creates a set in which the items are computed from the iterable.

For each element of the iterable it computes another iterable of items by applying mapper. The items of this resulting iterable will be added to the set.

Implementation

static ISet<T> fromIterable<T, I>(
  Iterable<I> iterable, {
  required Iterable<T>? Function(I) mapper,
  ConfigSet? config,
}) {
  config ??= defaultConfig;
  var result = ListSet.of(iterable.expand(mapper as Iterable<T> Function(I)), sort: config.sort);
  return ISetImpl<T>._unsafeFromSet(result, config: config);
}