update method

  1. @override
Future<void> update(
  1. Uri golden,
  2. Uint8List imageBytes

Updates the golden file identified by golden with imageBytes.

This will be invoked in lieu of compare when autoUpdateGoldenFiles is true (which gets set automatically by the test framework when the user runs flutter test --update-goldens).

The method by which golden is located and by which its bytes are written is left up to the implementation class.


Future<void> update(Uri golden, Uint8List imageBytes) async {
  final File goldenFile = _getGoldenFile(golden);
  await goldenFile.parent.create(recursive: true);
  await goldenFile.writeAsBytes(imageBytes, flush: true);