There are a number of sync and async operations for files in dart:io:
file.deleteSync()andfile.delete()file.readAsStringSync()andfile.readAsString()file.writeAsBytesSync(bytes)andfile.writeAsBytes(bytes)- and many, many more.
What are the considerations that I should keep in mind when choosing between the sync and async options? I seem to recall seeing somewhere that the sync option is faster if you have to wait for it to finish anyway (await file.delete() for example). But I can't remember where I saw that or if it is true.
Is there any difference between this method:
Future deleteFile(File file) async {
await file.delete();
print('deleted');
}
and this method:
Future deleteFile(File file) async {
file.deleteSync();
print('deleted');
}