SdkLocator class abstract final

Finds the Flutter SDK a project uses.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

find(String projectRoot, {String? configured, Map<String, String>? environment, Duration timeout = const Duration(seconds: 20)}) → Future<FlutterSdk?>
locate, and when that finds nothing, the SDK the first flutter on the PATH says it runs (flutterRoot from flutter --version --machine): how a snap's launcher, or a version manager's shim, is found. The launcher gets timeout (a first run can set its SDK up for minutes); then it is stopped, with what it started, and taken as not knowing. Its answer is kept for the rest of this process.
locate(String projectRoot, {String? configured, Map<String, String>? environment}) → FlutterSdk?
The SDK for projectRoot, trying in order: configured (a setting), the FLUTTER_ROOT environment variable, the SDK that last ran pub (flutterRoot in package_config.json), and flutter on the PATH where it is a link into an SDK. Null when none is found. It never starts a program; find also asks a launcher outside an SDK (a snap's, a version manager's shim), and locate then reuses its answer. Setting FLUTTER_ROOT to the SDK's folder always works.