flutter_a11y_lints library

Flutter accessibility analyzer - semantic IR-based accessibility analysis

Classes

A01UnlabeledInteractive
A01: Label Non-Text Controls
A01Violation
A02AvoidRedundantRoleWords
A02: Avoid Redundant Role Words
A02Violation
A03DecorativeImagesExcluded
A03: Decorative images should be excluded from semantics.
A03Violation
A04InformativeImagesLabeled
A04Violation
A05NoRedundantButtonSemantics
A05: No redundant Semantics wrappers on Material buttons.
A05Violation
A06MergeMultiPartSingleConcept
A06: Merge Multi-Part Single Concept
A06Violation
A07ReplaceSemanticsCleanly
A07: Replace Semantics Cleanly
A07Violation
A09NumericValuesRequireUnits
A09 — Numeric values should include units
A09Violation
A11MinimumTapTargetSize
A11 — Minimum Tap Target Size (literal-only conservative check)
A11Violation
A13SingleRoleCompositeControl
A13 — Single Semantic Role For Composite Controls Warn only when a semantic boundary/composite host aggregates multiple focusable descendants without merging them into one role. Layout widgets (Row/Column/ListView/etc.) are excluded to prevent noise.
A13Violation
A15MapCustomGesturesToOnTap
A15 — Mirror custom gestures to semantics actions Conservative: flag GestureDetector usages that have tap handlers but no accessible label or semantics wrapper.
A15Violation
A16ToggleStateViaSemanticsFlag
A16 — Toggle State Via Semantics Flags Detect Semantics wrappers that encode toggle state in their label instead of using the dedicated toggled/checked properties. This focuses on Semantics containers that sit above Toggle widgets (Switch/Checkbox/etc.).
A16Violation
A18AvoidHiddenFocusTraps
A18: Avoid hidden focus traps created by Offstage/Visibility.
A18Violation
A21UseIconButtonTooltip
A21: Prefer IconButton.tooltip over wrapping in Tooltip widget.
A21Violation
A22RespectWidgetSemanticBoundaries
A22: Respect widget semantic boundaries (ListTile family).
A22Violation
A24ExcludeVisualOnlyIndicators
A24 — Exclude visual-only drag handle icons
A24Violation
BuildSemanticContext
Build-scoped context that tracks transient semantic state.
GlobalSemanticContext
Global context shared across semantic builds.
KnownSemantics
Static metadata for a widget type. This is read-only and should reflect widget-level behavior that does not depend on instance args (except where explicitly noted in slotTraversalOrder).
KnownSemanticsRepository
Repository that exposes the v2.6 known semantics catalogue.
SemanticBuilder
SemanticBuilder
SemanticIrBuilder
SemanticNeighborhood
Utility helpers for reasoning about nearby semantic nodes.
SemanticNode
Simplified semantic IR node used by rules and the tree annotator.
SemanticSummary
Summary of a custom widget's semantic behavior. A compact, serializable summary describing the observable accessibility behaviour of a custom widget class.
SemanticTree
Annotated semantic tree with physical and accessibility-focused views.
WidgetNode
Lightweight representation of a widget instantiation in the AST.

Enums

ControlKind
ControlKind is a more specific classification that helps rules distinguish between types of controls that share a role (e.g., IconButton vs. ElevatedButton both map to button role but have different expectations).
LabelGuarantee
How confident the builder is that a node has a usable label.
LabelSource
Origin of a discovered label. Rules may use this to prefer certain label sources (e.g., prefer explicit Semantics.label over a tooltip when resolving conflicts).
SemanticRole
This file defines the normalized metadata used by the semantic builder to understand built-in Flutter widget semantics. The KnownSemantics table is intended to be generated from a JSON catalogue (data/known_semantics_v2.6.json) and contains per-widget static behavior useful for building the IR.
WidgetNodeType
Classification for widget nodes so we can retain control-flow structure.

Functions

extractBuildBodyExpression(MethodDeclaration method) → Expression?
fileUsesFlutter(ResolvedUnitResult unit) → bool
findBuildMethods(CompilationUnit unit) → List<MethodDeclaration>
Finds all build methods in a compilation unit.