Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the port of Chrome when running "flutter run -d chrome" for localStorage?

Tags:

flutter

Is there any way to set the port of Chrom 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

like image 421
TobiHeidi Avatar asked Sep 18 '19 10:09

TobiHeidi


2 Answers

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

like image 164
sys1yagi Avatar answered Oct 13 '22 11:10

sys1yagi


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.
like image 22
M Karimi Avatar answered Oct 13 '22 11:10

M Karimi