meetsGuideline function
- AccessibilityGuideline guideline
Asserts that the currently rendered widget meets the provided accessibility
guideline
.
This matcher requires the result to be awaited and for semantics to be enabled first.
Sample code
testWidgets('containsSemantics', (WidgetTester tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
// ...
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
Supported accessibility guidelines:
- androidTapTargetGuideline, for Android minimum tappable area guidelines.
- iOSTapTargetGuideline, for iOS minimum tappable area guidelines.
- textContrastGuideline, for WCAG minimum text contrast guidelines.
- labeledTapTargetGuideline, for enforcing labels on tappable areas.
Implementation
AsyncMatcher meetsGuideline(AccessibilityGuideline guideline) {
return _MatchesAccessibilityGuideline(guideline);
}