15

Is there any way to set the port of Chrome when running "flutter run -d chrome"? Without it my localStorage is lost on every run due to the new port/origin.

Or is there another way to keep localStorage across different ports?

Dom
  • 3,173
  • 4
  • 30
  • 39
TobiHeidi
  • 1,201
  • 2
  • 14
  • 23

2 Answers2

19

I also faced the same problem. so, I looked for sources related to the flutter run command and found the web options for the command.

https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/runner/flutter_command.dart#L137

You can set any port using the --web-port option.

flutter run -d chrome --web-port 8080

sys1yagi
  • 191
  • 4
10

you can using any below command to launch flutter web app:

flutter run -d chrome --web-port 8080
flutter run -d edge --web-port 8080
flutter run -d web-server --web-port 8080

also you can add the additional parameters to the run configuration as this:

add `--web-port=8080` to `Additional arguments` in run configuration into toolbar.
M Karimi
  • 1,991
  • 1
  • 17
  • 34