saveFile method

Future<void> saveFile(
  1. String path,
  2. Uint8List bytes
)

Implementation

Future<void> saveFile(String path, Uint8List bytes) async {
  try {
    final file = File(path);
    await file.parent.create(recursive: true);
    await file.writeAsBytes(bytes);
  } on FileSystemException catch (e) {
    throw DownloadException('Failed to save file $path: ${e.message}');
  }
}