getGoldenBytes method Null safety

  1. @protected
Future<List<int>> getGoldenBytes(
  1. Uri golden
)
protected">@protected

Returns the bytes of the given golden file.

If the file cannot be found, an error will be thrown.

Implementation

@protected
Future<List<int>> getGoldenBytes(Uri golden) async {
  final File goldenFile = _getGoldenFile(golden);
  if (!goldenFile.existsSync()) {
    fail(
      'Could not be compared against non-existent file: "$golden"'
    );
  }
  final List<int> goldenBytes = await goldenFile.readAsBytes();
  return goldenBytes;
}