fileLock function

void fileLock(
  1. String path
)

Implementation

void fileLock(String path) {
  final file = File(path);
  file.openSync(mode: FileMode.write).lockSync();
  onExit(() {
    if (file.existsSync()) file.deleteSync();
  });
}