isFileLocked static method

bool isFileLocked(
  1. File file
)

Returns whether the given file is locked or not.

Implementation

static bool isFileLocked(File file) {
  try {
    file.openSync(mode: FileMode.append).closeSync();
    return false;
  } catch (_) {
    return true;
  }
}