cloneList<E> method

  1. @override
List<E> cloneList<E>(
  1. List<E> source
)
override

Clones a List with enforced nesting depth limit.

Throws LimitExceededException if the nesting limit is exceeded.

Implementation

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