dispose method

void dispose()

Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).

Implementation

void dispose() {
  _disposed = true;
  _listeners.clear();
}