writeImage method
- List<
int> image, - String cameraName
Saves the current frame in the feed to the camera's output directory.
Implementation
Future<void> writeImage(List<int> image, String cameraName) async {
final dir = await Directory("${screenshotsDir.path}/$cameraName").create(recursive: true);
final files = dir.listSync();
final number = files.isEmpty ? 1 : (int.parse(files.last.filename) + 1);
await File("${dir.path}/$number.jpg").writeAsBytes(image);
}