setIDEWorkspaceRoots method

Future<void> setIDEWorkspaceRoots(
  1. String secret,
  2. List<Uri> roots
)

Sets the IDE workspace roots for the FileSystem service.

This is a privileged RPC that require's a secret, which is provided by the Dart Tooling Daemon, to be called successfully. This secret is generated by the daemon and provided to its spawner to ensure only trusted clients can set workspace roots. If secret is invalid, an RpcException with error code RpcErrorCodes.kPermissionDenied is thrown.

If secret does not match the secret created when Dart Tooling Daemon was created, then an RpcException with RpcErrorCodes.kPermissionDenied is thrown.

If one of the roots is missing a "file" scheme then an RpcException with RpcErrorCodes.kExpectsUriParamWithFileScheme is thrown.

Implementation

Future<void> setIDEWorkspaceRoots(String secret, List<Uri> roots) async {
  await call(
    kFileSystemServiceName,
    'setIDEWorkspaceRoots',
    params: {
      'roots': roots.map<String>((e) => e.toString()).toList(),
      'secret': secret,
    },
  );
}