semantics library Null safety

The Flutter semantics package.

To use, import package:flutter/semantics.dart.

The SemanticsEvent classes define the protocol for sending semantic events to the platform.

The SemanticsNode hierarchy represents the semantic structure of the UI and is used by the platform-specific accessibility services.

Classes

AccessibilityFeatures
Additional accessibility features that may be enabled by the platform.
AnnounceSemanticsEvent
An event for a semantic announcement.
AttributedString
A string that carries a list of StringAttributes.
AttributedStringProperty
A DiagnosticsProperty for AttributedStrings, which shows a string when there are no attributes, and more details otherwise.
CustomSemanticsAction
An identifier of a custom semantics action.
DiagnosticPropertiesBuilder
Builder to accumulate properties and configuration used to assemble a DiagnosticsNode from a Diagnosticable object.
DiagnosticsNode
Defines diagnostics data for a value.
Key
A Key is an identifier for Widgets, Elements and SemanticsNodes.
LocaleStringAttribute
A string attribute that causes the assistive technologies, e.g. VoiceOver, to treat string as a certain language.
LongPressSemanticsEvent
An event which triggers long press semantic feedback.
Matrix4
4D Matrix. Values are stored in column major order.
Offset
An immutable 2D floating-point offset.
OrdinalSortKey
A SemanticsSortKey that sorts simply based on the double value it is given.
Rect
An immutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.
SemanticsAction
The possible actions that can be conveyed from the operating system accessibility APIs to a semantics node.
SemanticsConfiguration
Describes the semantic information associated with the owning RenderObject.
SemanticsData
Summary information about a SemanticsNode object.
SemanticsEvent
An event sent by the application to notify interested listeners that something happened to the user interface (e.g. a view scrolled).
SemanticsFlag
A Boolean value that can be associated with a semantics node.
SemanticsHintOverrides
Provides hint values which override the default hints on supported platforms.
SemanticsNode
A node that represents some semantic data.
SemanticsOwner
Owns SemanticsNode objects and notifies listeners of changes to the render tree semantics.
SemanticsProperties
Contains properties used by assistive technologies to make the application more accessible.
SemanticsService
Allows access to the platform's accessibility services.
SemanticsSortKey
Base class for all sort keys for SemanticsProperties.sortKey accessibility traversal order sorting.
SemanticsTag
A tag for a SemanticsNode.
SemanticsUpdateBuilder
An object that creates SemanticsUpdate objects.
SpellOutStringAttribute
A string attribute that causes the assistive technologies, e.g. VoiceOver, to spell out the string character by character.
StringAttribute
An abstract interface for string attributes that affects how assistive technologies, e.g. VoiceOver or TalkBack, treat the text.
TapSemanticEvent
An event which triggers tap semantic feedback.
TextSelection
A range of text that represents a selection.
TextTreeConfiguration
Configuration specifying how a particular DiagnosticsTreeStyle should be rendered as text art.
TooltipSemanticsEvent
An event for a semantic announcement of a tooltip.

Mixins

SemanticsBinding
The glue between the semantics layer and the Flutter engine.

Properties

debugSemanticsDisableAnimations bool?
Overrides the setting of SemanticsBinding.disableAnimations for debugging and testing.
read / write

Functions

debugResetSemanticsIdCounter() → void
In tests use this function to reset the counter used to generate SemanticsNode.id.

Enums

Assertiveness
Determines the assertiveness level of the accessibility announcement.
DebugSemanticsDumpOrder
Used by debugDumpSemanticsTree to specify the order in which child nodes are printed.
DiagnosticLevel
The various priority levels used to filter which diagnostics are shown and omitted.
DiagnosticsTreeStyle
Styles for displaying a node in a DiagnosticsNode tree.
TextDirection
A direction in which text flows.

Typedefs

MoveCursorHandler = void Function(bool extendSelection)
Signature for SemanticsActions that move the cursor.
SemanticsActionHandler = void Function(Object? args)
Signature for a handler of a SemanticsAction.
SemanticsNodeVisitor = bool Function(SemanticsNode node)
Signature for a function that is called for each SemanticsNode.
SetSelectionHandler = void Function(TextSelection selection)
Signature for the SemanticsAction.setSelection handlers to change the text selection (or re-position the cursor) to selection.
SetTextHandler = void Function(String text)
Signature for the SemanticsAction.setText handlers to replace the current text with the input text.
VoidCallback = void Function()
Signature of callbacks that have no arguments and return no data.