golden_tools library

Lower-level snaptest utilities for custom screenshot workflows.

Import this alongside snaptest.dart when you need direct access to image capture, text blocking, or font loading helpers.

Classes

BlockedTextCanvasAdapter
A Canvas adapter that delegates all drawing operations to parent, except it skips drawing paragraphs entirely.
BlockedTextPaintingContext
A painting context that replaces all text with colored rectangles.

Extensions

CaptureFinder on Finder
Allows capturing the closest RepaintBoundary of a Finder into an image.
CaptureImage on Element
Allows capturing the closest RepaintBoundary of an element into an image.

Functions

loadFont(String family, List<String> fromPaths) Future<void>
Loads fonts from the given fromPaths into the Flutter engine under the specified family.
loadFonts({CupertinoFontConfig cupertinoFonts = const CupertinoFontConfig.override()}) Future<void>
Loads fonts and icons required for consistent screenshot rendering.
precacheImages([Finder? from]) Future<void>
Pre-caches all images so that they will be rendered correctly when taking screenshots.
setTestViewForDevice(DeviceInfo? device, Orientation orientation) VoidCallback
Temporarily changes the test environment to simulate a specific device.