sdkPath top-level property

String? get sdkPath

The path to the root of the Dart SDK, or null if no SDK could be located.

Probes the host environment across four tiers (memoized on first access):

  1. Platform.resolvedExecutable (active JIT VM runtime)
  2. DART_ROOT and DART_SDK environment variables
  3. PATH environment variable traversal (dereferencing symlinks and checking Flutter cache layouts)
  4. FLUTTER_ROOT/bin/cache/dart-sdk fallback

Implementation

String? get sdkPath {
  if (Zone.current[environmentOverridesKey] != null) {
    return _resolveSdkPath();
  }
  if (!_sdkPathResolved) {
    _cachedSdkPath = _resolveSdkPath();
    _sdkPathResolved = true;
  }
  return _cachedSdkPath;
}