dispose method

  1. @override
void dispose()
override

Disposes of the document

Events already published but not handed out yet are delivered first. A consumer that mirrors this document — a persistence adapter — would otherwise never learn about the last move, because the closed controller drops what the outbox still holds.

Implementation

@override
void dispose() {
  if (_isDisposed) {
    return;
  }

  _flushOutbox();
  _documentEvents.close();
  _undo.dispose();
  super.dispose();
  _cache.clear();
}