So I have this function, which I use to launch urls in Brave Browser. I would like to be able to use the --profile-directory switch to launch my urls in specific profiles, but Dart treats the quotes in my argument differently. Here is the command I want to execute:
start brave --profile-directory="Profile 1" "https://example.com"
The Dart code is this:
Process.run(
"start",
[
'brave',
'--profile-directory="Profile 1"',
url,
],
runInShell: true,
);
However, it replaces my double quotes with a "\". I'm greeted with an error dialog that says "Windows cannot find 1\" ". Make sure you typed the name correctly, and then try again.
I tried escaping them by using '\"Profile 1\"'
but that didn't help either.
This was the case for a while, but now theres something unusual happening. The same command launches Brave in the Profile select window, asking me to choose a profile.
I also tried passing the arguments like this : ['brave', '--profile-directory', '"Profile 1"']
. This command doesn't even launch brave.
How do I properly execute said command using Process.run()? I'm using Flutter for Windows.