A11yReport class
A point-in-time snapshot of every violation found below a BuildContext, exportable as JSON or Markdown — the CI/report counterpart to A11yLensOverlay's live view.
Runs headless under flutter test: no real device or screen reader is
needed, since ElementTreeWalker and SemanticsTreeWalker both read
data the engine already computes during a normal widget-test pump. See
package:flutter_a11y_lens/testing.dart for a ready-made flutter test harness
built on this.
- Annotations
Constructors
-
A11yReport({required List<
A11yViolation> violations, required DateTime generatedAt}) -
const
-
A11yReport.fromJson(Map<
String, Object?> json) -
factory
Properties
- generatedAt → DateTime
-
final
- hasErrors → bool
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasViolations → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
violations
→ List<
A11yViolation> -
final
Methods
-
countBySeverity(
A11ySeverity severity) → int -
newViolationsComparedTo(
A11yReport baseline) → List< A11yViolation> -
Violations in this report with no equivalent in
baseline— the "fail the PR build on new violations" workflow, comparing against a baseline generated by an earlier run (e.g. loaded via A11yReport.fromJson from a checked-in file). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
toJsonString(
{bool pretty = true}) → String - Pretty-printed by default — the common case is a checked-in baseline file or CI log output, where readability matters more than size.
-
toMarkdown(
) → String -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
generate(
BuildContext context, {List< A11yRule> rules = const [ContrastRule(), TapTargetSizeRule()], List<A11ySemanticsRule> semanticsRules = const [SemanticLabelRule(), FocusOrderRule()]}) → A11yReport -
Walks
contextwith ElementTreeWalker and, ifsemanticsRulesis non-empty, SemanticsTreeWalker too, runs every rule, and returns the combined result.