clear method

  1. @override
void clear()
override

Removes all entries from the map.

After this, the map is empty.

final planets = <int, String>{1: 'Mercury', 2: 'Venus', 3: 'Earth'};
planets.clear(); // {}

Implementation

@override
void clear() {
  if (_isReadonly) {
    throw UnsupportedError('Attempted to change a read-only map field');
  }
  _wrappedMap.clear();
}