screenMatchesGolden function

Future<void> screenMatchesGolden(
  1. WidgetTester tester,
  2. String name, {
  3. bool? autoHeight,
  4. Finder? finder,
  5. CustomPump? customPump,
  6. @Deprecated('This method level parameter will be removed in an upcoming release. This can be configured globally. If you have concerns, please file an issue with your use case.') bool? skip,
})

A function that wraps matchesGoldenFile with some extra functionality. The function finds the first widget in the tree if finder is not specified. Furthermore a fileNameFactory can be used in combination with a name to specify a custom path and name for the golden file. In addition to that the function makes sure all images are available before

name is the name of the golden test and must NOT include extension like .png.

finder is an optional finder, which can be used to target a specific widget to use for the test. If not specified the first widget in the tree is used

autoHeight tries to find the optimal height for the output surface. If there is a vertical scrollable this ensures the whole scrollable is shown. If the targeted render box is smaller then the current height, this will shrink down the output height to match the render boxes height.

customPump optional pump function, see CustomPump documentation

skip by setting to true will skip the golden file assertion. This may be necessary if your development platform is not the same as your CI platform

Implementation

Future<void> screenMatchesGolden(
  WidgetTester tester,
  String name, {
  bool? autoHeight,
  Finder? finder,
  CustomPump? customPump,
  @Deprecated('This method level parameter will be removed in an upcoming release. This can be configured globally. If you have concerns, please file an issue with your use case.')
      bool? skip,
}) {
  return compareWithGolden(
    tester,
    name,
    autoHeight: autoHeight,
    finder: finder,
    customPump: customPump,
    skip: skip,
    // This value is actually ignored. We are forced to pass it because the
    // downstream API is structured poorly. This should be refactored.
    device: Device.phone,
    fileNameFactory: (String name, Device device) =>
        GoldenToolkit.configuration.fileNameFactory(name),
  );
}