dispose method Null safety

  1. @mustCallSuper
void dispose()

Closes the semantics handle and stops calling listener when the semantics updates.

When all the outstanding SemanticsHandle objects for a given PipelineOwner are closed, the PipelineOwner will stop updating the semantics tree.

Implementation

@mustCallSuper
void dispose() {
  if (listener != null) {
    _owner.semanticsOwner!.removeListener(listener!);
  }
  _owner._didDisposeSemanticsHandle();
}