writeToFile method
- String filePath
Implementation
Future<void> writeToFile(String filePath) async {
final file = File(filePath);
if (file.existsSync())
file.deleteSync(); // Ensure we flush the file to 0 bytes
await file.writeAsBytes(bytes);
}