createSymLink function

void createSymLink({
  1. required String targetPath,
  2. required String linkPath,
})

Creates a link at linkPath which points to an existing file or directory at targetPath

On Windows you need to be in developer mode or running as an Administrator to create a symlink.

To enable developer mode see: https://dcli.onepub.dev/getting-started/installing-on-windows

To check if your script is running as an administrator use:

Shell.current.isPrivilegedUser

See:

Implementation

void createSymLink({
  required String targetPath,
  required String linkPath,
}) {
  verbose(() => 'createLink targetPath: $targetPath linkPath $linkPath');
  Link(linkPath).createSync(targetPath);
}