Returns whether the given file is locked or not.
static bool isFileLocked(File file) { try { file.openSync(mode: FileMode.append).closeSync(); return false; } catch (_) { return true; } }