ensureSemantics method

SemanticsHandle ensureSemantics()

Creates a new SemanticsHandle and requests the collection of semantics information.

Semantics information are only collected when there are clients interested in them. These clients express their interest by holding a SemanticsHandle.

Clients can close their SemanticsHandle by calling SemanticsHandle.dispose. Once all outstanding SemanticsHandle objects are closed, semantics information are no longer collected.

Implementation

SemanticsHandle ensureSemantics() {
  assert(_outstandingHandles >= 0);
  _outstandingHandles++;
  assert(_outstandingHandles > 0);
  _semanticsEnabled.value = true;
  return SemanticsHandle._(_didDisposeSemanticsHandle);
}