clear method
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() {
var len = _map.length;
if (hasObservers && len > 0) {
_map.forEach((key, value) {
notifyChange(MapChangeRecord<K, V>.remove(key, value));
});
notifyPropertyChange(#length, len, 0);
_notifyKeysValuesChanged();
}
_map.clear();
}