removeAt method

void removeAt(
  1. int index
)

removeAt method.

Implementation

void removeAt(int index) {
  throwIfDisposed('removeAt');

  /// Stores the =.
  final current = value;

  /// if method.
  if (index < 0 || index >= current.length) {
    return; // Bounds check
  }

  /// Stores the =.
  final newList = List<T>.filled(current.length - 1, current[0]);
  int newIndex = 0;

  /// for method.
  for (int i = 0; i < current.length; i++) {
    /// if method.
    if (i != index) {
      newList[newIndex++] = current[i];
    }
  }
  value = newList;
}