sdk_discovery library

SDK discovery utilities for Dart tools and AOT executables.

Properties

dartExecutable String
Throwing getter that returns the absolute path to the dart binary.
no setter
flutterExecutable String
Throwing getter that returns the absolute or command path to flutter.
no setter
sdkPath String
Throwing getter that locates a Dart SDK root using findSdkPath.
no setter

Functions

findDartExecutable({String? sdkPath}) String?
Returns the absolute path to the dart executable inside the discovered SDK, or null if no valid SDK/binary is found.
findFlutterExecutable({String? flutterRoot}) String?
Locates the flutter CLI executable, probing FLUTTER_ROOT, PATH, and standard Flutter checkout directories.
findSdkPath() String?
Locates a Dart SDK root, probing in order: the running VM's executable, the DART_SDK environment variable, dart binaries on PATH (including Flutter checkouts, whose wrapper script hides the SDK under bin/cache/dart-sdk), FLUTTER_ROOT, and standard system SDK locations.
hasEnclosingPackageConfig(String packagePath) bool
Whether packagePath or any ancestor directory contains a .dart_tool/package_config.json file.
hasPackageConfig(String packagePath) bool
Whether packagePath contains a .dart_tool/package_config.json file.
isFlutterPackage(String packagePath) bool
Whether the package at packagePath is a Flutter package (e.g. declares sdk: flutter or depends on package:flutter).
isFlutterPubspec(String pubspecContent) bool
Whether pubspecContent indicates a Flutter package.
isValidSdk(String path) bool
Whether path looks like a Dart SDK root usable by the analyzer.
isValidSdkPath(String path) bool
Alias for isValidSdk.
resolveSdkFromDir(String dir, String executableName) String?
Resolves an SDK root from a directory containing a dart executable.
runPubGet(String packagePath, {String? sdkPath, String? flutterRoot, List<String> additionalArgs = const []}) ProcessResult
Runs pub get (routing to flutter pub get or dart pub get) for the package at packagePath.