When running Flutter web app in Chrome in debug mode, each time any settings the site had is cleared. This is because it uses a random port for each launch. To preserve settings like local storage and other site settings across debug launches use the same port.
For Visual Studio Code, add "-d", "chrome","--web-port", "8000"
to args
in .vscode/launch.json
.
{
"version": "0.2.0",
"configurations": [
{
"name": "Flutter Web Chrome (debug mode)",
"request": "launch",
"type": "dart",
"program": "lib/main.dart",
"flutterMode": "debug",
"args": ["-d", "chrome", "--web-port", "8000"]
}
]
}
When running from command line, use flutter run -d chrome --web-port 8000
.