Skip to content

Implement dart_data_home and DART_DATA_HOME (XDG-state) in Dart and Flutter tooling #62952

Description

@dcharkes

2af3166 landed support for storing data created by Dart and Flutter tooling in a central location that satisfies OS-specifications.

The directory location depends on the current OS:

  • on Windows:
    • %LOCALAPPDATA%\Dart\<tool>
  • on Mac OS:
    • $HOME/Library/Application Support/Dart/<tool>
  • on Linux:
    • $XDG_STATE_HOME/Dart/<tool> if $XDG_STATE_HOME is defined, and
    • $HOME/.local/state/Dart/<tool> otherwise.

The Dart data home can be overridden with the DART_DATA_HOME environment variable.

This has been adopted in a handful of places, but various parts of the Dart and Flutter tooling have not been migrated yet:

  • ~/.dart-tool/ (containing telemetry data)
  • ~/.dart/ (extra executables)
  • ~/.dartServer/ (analysis server)
  • ~/.pub-cache (introduced in the days when pub was a standalone tool rather than dart pub)
  • ~/.flutter-devtools/.devtools
  • system temp (resident frontend server caching dills)

We are open for receiving PRs to migrate these existing places. Please also provide a migration strategy. (E.g. Do we keep the old dir as fallback? Do we write code to move the directory? What happens on upgrades/downgrades of the Dart and Flutter SDK.)

We are not interested in endless discussions. So please keep your comments here to questions on how to implement this. (If you're interested in the discussions you can read the very long discussion threads in their full length. #60922 #41560)

Update: package:dart_data_home has been published, so flutter_tool can be updated as well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions