DartToolPaths class

Where dart pub global activate and dart install put their files, computed from an environment map so that every platform can be tested.

Rules (verified against the sources on 2026-09-28):

  • pub cache (pub system_cache.dart): PUB_CACHE, else %LOCALAPPDATA%\Pub\Cache on Windows, else ~/.pub-cache; binstubs in its bin directory.
  • Dart data home (package dart_data_home): DART_DATA_HOME, else the OS state directory for Dart: %LOCALAPPDATA%\Dart, ~/Library/Application Support/Dart, $XDG_STATE_HOME/Dart or ~/.local/state/Dart. dart install uses its install directory, with links (or .bat wrappers) in install/bin and app bundles in install/app-bundles.

Neither tool has a destination option: set PUB_CACHE or DART_DATA_HOME before installing to change the location.

Constructors

DartToolPaths({required DartToolOs os, required Map<String, String> environment})
Rules for os with environment.

Properties

dartDataHomePath → String
The Dart data home.
no setter
dartInstallAppBundlesPath → String
Where dart install puts its app bundles (<package>/{hosted/<version>,git/<hash>,local}/bundle).
no setter
dartInstallBinPath → String
Where dart install puts its links (or .bat wrappers on Windows).
no setter
dartInstallPath → String
The dart install directory.
no setter
environment → Map<String, String>
The environment variables used.
final
hashCode → int
The hash code for this object.
no setterinherited
homePath → String
The user home (HOME, or USERPROFILE on Windows).
no setter
isWindows → bool
True on Windows.
no setter
os → DartToolOs
The operating system.
final
pathEntries → List<String>
The PATH entries, in order.
no setter
pathSeparator → String
The PATH separator.
no setter
pubCacheBinPath → String
Where dart pub global activate puts its binstubs.
no setter
pubCachePath → String
The pub cache.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

environmentValue(String key) → String?
Environment value, case insensitive on Windows.
isDirOnPath(String dir) → bool
True if dir is on PATH.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pathIndexOf(String dir) → int
Index of dir in PATH (trailing separators and case on Windows ignored), -1 if absent.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited