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() {
_context.conditionallyRunInAction(() {
if (isEmpty) {
return;
}
if (_hasListeners) {
final removed = Map<K, V>.from(_map);
_map.clear();
removed.forEach(_reportRemove);
} else {
_map.clear();
}
_atom.reportChanged();
}, _atom);
}