clear method

  1. @override
void clear()
override

Removes all objects from this list; the length of the list becomes zero.

The list must be growable.

final numbers = <int>[1, 2, 3];
numbers.clear();
print(numbers.length); // 0
print(numbers); // []

Implementation

@override
void clear() {
  if (length > 0) {
    // Stop listening to children
    _stopPropagateNotification();
    _values.clear();
    notifyListeners();
  }
}