locale_sweep library

Localization release QA for Flutter.

Runs app flows across every locale, viewport size, text scale, and RTL mode, then reports broken screens with screenshot proof.

Classes

ArbAnalyzer
Static analyzer for ARB (Application Resource Bundle) translation files.
ArbFileLoading
The ARB files found in a directory, plus the ones that failed to parse.
ArbIssue
A single issue found during ARB analysis.
ArbMessageMatcher
Matches rendered strings against the ARB messages they could come from.
ArbReport
Result of an ARB analysis containing all detected issues.
DiffResult
Result of comparing two golden screenshots pixel-by-pixel.
GoldenDiffer
Computes pixel-level diffs between golden screenshots and generates side-by-side comparison images.
HardcodedTextDetector
Finds rendered text that does not come from the ARB files.
HardcodedTextIssue
Rendered text that matches no ARB message for the variant's locale.
OverflowDetector
Intercepts FlutterError.onError to capture RenderFlex overflow errors.
OverflowError
A captured RenderFlex overflow error with optional pixel count.
ParsedReport
PseudoLocalizer
Rewrites rendered text into a longer, accented pseudo-locale form.
ReportGenerator
Generates Markdown and JSON reports from sweep results.
SweepConfig
Configuration for a sweep run, loadable from locale_sweep.yaml.
SweepGoldenComparator
A golden file comparator that computes pixel diffs and applies tolerance.
SweepResult
The result of running a single sweep variant.
SweepRunSummary
Aggregates SweepResults with summary statistics.
SweepVariant
A single combination of locale, text scale, viewport, and brightness to test.
TruncationDetector
Walks the render tree after layout to find silently truncated text.
TruncationIgnores
Convenience builders for the most common ignore rules, so users don't have to hand-roll TruncationIgnore predicates.
TruncationIssue
A text element that was silently truncated (ellipsis, clip, or fade).
ViewportPreset
A named viewport size used to simulate layout dimensions in tests.

Enums

ArbIssueType
The type of issue found during ARB analysis.
SweepFailureKind
Distinguishes golden assertions from failures executing a test.

Constants

actualScreenshotsDir → const String
Directory where the actual screenshot of a failing variant is written.
pseudoLocale → const String
Locale code that renders the base locale with pseudo-localized text.
sweepResultsDir → const String
Default directory where sweep results are written for CLI consumption.

Properties

sweepResults → List<SweepResult>
Returns all results recorded by sweepTest in this test isolate.
no setter

Functions

clearSweepResults() → void
Clears all recorded sweep results.
discoverPackages(String root, {String testDir = 'test/sweep'}) → List<String>
loadResults(SweepConfig cfg, {String resultsPath = '.locale_sweep/results'}) → ParsedReport?
mergeResults(List<SweepResult> results, {List<String> executionErrors = const []}) → ParsedReport
parseFlowFromName(String testName) → String
parseLocale(String code) → Locale
Parses a BCP-47 locale string into a Locale.
parseMachineOutput(String output, SweepConfig cfg) → ParsedReport
parseVariantFromName(String testName, SweepConfig cfg) → SweepVariant
shouldFail(ParsedReport report, Set<String> failOn) → bool
sweepTest(String flowName, {Widget builder()?, Widget builderWithVariant(SweepVariant variant)?, SweepBody? body, SweepVariantBody? variantBody, SweepConfig? config, List<String>? locales, List<double>? textScales, List<ViewportPreset>? viewports, bool? darkMode, ThemeData? lightTheme, ThemeData? darkTheme, String? arbDir, String? baseLocale, List<String>? untranslatedAllowlist, bool captureScreenshots = true, bool compareScreenshots = true, String? screenshotDir, bool skip(SweepVariant variant)?, double? tolerance, String diffOutputDir = '.locale_sweep/diffs', Future<void> setUp()?, List<LocalizationsDelegate>? localizationsDelegates, List<TruncationIgnore>? ignoreTruncation, bool? detectHardcodedText, List<String>? hardcodedTextAllowlist}) → void
Generates locales × textScales × viewports (× brightness) test cases for flowName.

Typedefs

SweepBody = Future<void> Function(WidgetTester tester)
Callback for interactions to run after the widget is pumped.
SweepVariantBody = Future<void> Function(WidgetTester tester, SweepVariant variant)
Callback that also receives the current SweepVariant for locale-aware interactions.
TruncationIgnore = bool Function(TruncationIssue issue, Element? element)
Predicate used to exclude a detected TruncationIssue from the report.