I need the help of CLI tools for certain tasks, I added them in the asset of my app
<code> static Future<String> _assetToDisk(String key) async {
final byteData = await rootBundle.load(key);
final bytes = byteData.buffer.asUint8List();
final tempDir = path.join(Directory.systemTemp.path, "AppName");
await Directory(tempDir).create();
final executableFile = File(path.join(tempDir, path.basename(key)));
await executableFile.writeAsBytes(bytes);
return executableFile.path;
}
</code>
<code> static Future<String> _assetToDisk(String key) async {
final byteData = await rootBundle.load(key);
final bytes = byteData.buffer.asUint8List();
final tempDir = path.join(Directory.systemTemp.path, "AppName");
await Directory(tempDir).create();
final executableFile = File(path.join(tempDir, path.basename(key)));
await executableFile.writeAsBytes(bytes);
return executableFile.path;
}
</code>
static Future<String> _assetToDisk(String key) async {
final byteData = await rootBundle.load(key);
final bytes = byteData.buffer.asUint8List();
final tempDir = path.join(Directory.systemTemp.path, "AppName");
await Directory(tempDir).create();
final executableFile = File(path.join(tempDir, path.basename(key)));
await executableFile.writeAsBytes(bytes);
return executableFile.path;
}
Is there a better way to put a binary asset to disk so it can be executed using Process.run
?