clear method Null safety

  1. @override
void clear()
override

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

The list must be growable.

Implementation

@override
void clear() {
  _context.conditionallyRunInAction(() {
    if (_list.isNotEmpty) {
      final oldItems = _list.toList(growable: false);
      _list.clear();
      _notifyRangeUpdate(0, null, oldItems);
    }
  }, _atom);
}