cloneSet<E> method

  1. @override
Set<E> cloneSet<E>(
  1. Set<E> source
)
override

Clones a Set with enforced nesting depth limit.

Throws LimitExceededException if the nesting limit is exceeded.

Implementation

@override
Set<E> cloneSet<E>(Set<E> source) {
  if (_nestIndex > nestLimit) {
    throw LimitExceededException('depth', _nestIndex);
  }
  _nestIndex++;
  try {
    return super.cloneSet<E>(source);
  } finally {
    _nestIndex--;
  }
}