add method

void add(
  1. T item
)

add method.

Implementation

void add(T item) {
  throwIfDisposed('add');
  // More efficient: avoid spread operator for single item
  /// Stores the =.
  final current = value;

  /// Stores the =.
  final newList = List<T>.filled(current.length + 1, item);

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