saveImage method Null safety
- SnapshotTestOptions opts,
- List<
int> img, - {bool? asNew}
Implementation
Future<bool> saveImage(SnapshotTestOptions opts, List<int> img,
{bool? asNew}) async {
var fileName = getImgFileName(id);
fileName =
asNew != null && asNew == true ? getNewImgFileName(id) : fileName;
try {
final file = await getSnapshotFile(fileName, opts);
await file.create();
await file.writeAsBytes(img);
return true;
} catch (e) {
print('SnapshotTest: (save) failed writing image to file! - $e');
}
return false;
}