semantics property

SemanticsController get semantics

Provides access to a SemanticsController for testing anything related to the Semantics tree.

Assistive technologies, search engines, and other analysis tools all make use of the Semantics tree to determine the meaning of an application. If semantics has been disabled for the test, this will throw a StateError.

Implementation

SemanticsController get semantics {
  if (!binding.semanticsEnabled) {
    throw StateError(
      'Semantics are not enabled. Enable them by passing '
      '`semanticsEnabled: true` to `testWidgets`, or by manually creating a '
      '`SemanticsHandle` with `WidgetController.ensureSemantics()`.');
  }

  return _semantics;
}