IList<T>.withConfig constructor

IList<T>.withConfig(
  1. Iterable<T>? iterable,
  2. ConfigList config
)

Create an IList from any Iterable and a ConfigList. Fast, if the Iterable is another IList. If iterable is null, return an empty IList.

Implementation

factory IList.withConfig(
  Iterable<T>? iterable,
  ConfigList config,
) {
  return ((iterable is IList<T>) && (iterable.isOfExactGenericType(T)))
      ? (config == iterable.config)
          ? iterable
          : iterable.isEmpty
              ? IListImpl.empty<T>(config)
              : IListImpl<T>._(iterable, config: config)
      : (iterable == null)
          ? IListImpl.empty<T>(config)
          : IListImpl<T>._unsafe(LFlat<T>(iterable), config: config);
}