Flutter Devtools create file in my $HOME and don't allow for relocation
In my home directory the following directory is created whenever I use devtools:
$ tree -a ~/.flutter-devtools
/Users/bartek/.flutter-devtools
└── .devtools
Content of that single file is:
$ cat ~/.flutter-devtools/.devtools
{
"analyticsEnabled": true,
"isFirstRun": false,
"lastReleaseNotesVersion": "2.31.0",
"2023-Q4": {
"surveyActionTaken": false,
"surveyShownCount": 0
}
}
I don't like when programs clutter my personal ~. I very much echo sentiment of this article. Unfortunately it looks like the location of that file is currently hardcoded (example).
Therefore I'd like for Flutter DevTools to respect XDG Base Directory Specification, so that the .devtools file could be stored in (e.g.) ~/.local/state, that is, $XDG_STATE_HOME.
To support migration, Flutter Devtools would continue to use ~/.flutter-devtools/.devtools if it exists. If it does not exist, it should default to the appropriate XDG base directory.
I am willing to contribute this feature, if only the maintainers of this project agree with this suggestion.
My concern with changing the location of the .flutter-devtools/.devtools file is that it would not be consistent with what Flutter does for the .flutter file and the .flutter_tool_state file. These all live in the home directory:
@christopherfujino have there been any discussions around the location of the .flutter and .flutter_tool_state files WRT to not using the user's home directory? For DevTools, I think we should defer to the pattern that Flutter uses.
I'll risk a statement that Flutter is also doing the wrong thing with not respecting XDG Base Directory Specification – see https://github.com/flutter/flutter/issues/59430. Ditto for Dart – see https://github.com/dart-lang/sdk/issues/41560.
I had some spare time recently and spent it cleaning up my (sweet sweet) $HOME, and now I'm sad to say that the majority of unwanted files I have in my ~ right now come from either Flutter or Dart.
My concern with changing the location of the
.flutter-devtools/.devtoolsfile is that it would not be consistent with what Flutter does for the.flutterfile and the.flutter_tool_statefile. These all live in the home directory:
@christopherfujino have there been any discussions around the location of the
.flutterand.flutter_tool_statefiles WRT to not using the user's home directory? For DevTools, I think we should defer to the pattern that Flutter uses.
not that I'm aware of. I'm not against changing this, if we could come into alignment. I would just add, however, that while XDG is a nice idea, my current debian installation doesn't have $XDG_STATE_HOME set. Also, my understanding is that Windows and macOS don't follow XDG at all. That is to say, this migration would principally be of benefit to those Linux users who happened to have $XDG_STATE_HOME set.
anecdotal argument: I am on macOS and chose to follow XDG (=set the env vars) to keep my home dir clean :-)
anecdotal argument: I am on macOS and chose to follow XDG (=set the env vars) to keep my home dir clean :-)
ok, but by that argument, we could name the variable $FOO_BAR and you would be happy, right?
yeah I guess?
Anyway
if we could come into alignment
I'm all for that. I guess backward compatibility is the main concern, right?
polite ping :)
- an additional env var called e.g.
FLUTTER_DEVTOOLS_STATE_HOMEcould be introduced into devtools, or - devtools could start respecting
XDG_STATE_HOME
