when development, currently flutter always run a new chrome profile when ever we run the web, so to preserve storage after close web and run again, follow below guide
- add port param when run the app, because if we not set the port, flutter will always create a random port every run
--web-port 8686
2. open flutter/packages/flutter_tools/lib/src/web/chrome.dart
change
final Directory userDataDir = _fileSystem.systemTempDirectory
.createTempSync('flutter_tools_chrome_device.');
to
final Directory userDataDir = _fileSystem.currentDirectory.childDirectory('.dart_tool')
.childDirectory('chrome-device');
comment out
// if (cacheDir != null) {
// //Seed data dir with previous state.
// _restoreUserSessionInformation(cacheDir, userDataDir);
// }
............// if (cacheDir != null) {
// print('qqq cache delay ${cacheDir.path}');
// unawaited(process.exitCode.whenComplete(() {
// _cacheUserSessionInformation(userDataDir, cacheDir);
// }));
// }
then go to flutter/bin/cache and delete the flutter_tools.stamp (to force flutter tool build again) file then run the app again.