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
flutteron thePATHsays it runs (flutterRootfromflutter --version --machine): how a snap's launcher, or a version manager's shim, is found. The launcher getstimeout(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. -
installed(
String version, {String? projectRoot, Map< String, String> ? environment}) → FlutterSdk? -
An SDK of Flutter
versionon this machine, or null. Looks in the folderjustinstalls SDKs in (UserPaths.flutterDir), thenFLUTTER_ROOT, the SDK that last ran pub inprojectRoot,flutteron thePATH, and the SDKs fvm keeps ($FVM_CACHE_PATH/versionsor~/fvm/versions; only read, never written). -
isExactVersion(
String version) → bool -
Whether
versionnames one Flutter version (3.47.9,3.48.0-0.1.pre), not a channel or a range. -
locate(
String projectRoot, {String? configured, Map< String, String> ? environment}) → FlutterSdk? -
The SDK for
projectRoot, trying in order:configured(a setting); when the project pins a Flutter version (pinOf), an SDK of exactly that version (installed); then theFLUTTER_ROOTenvironment variable, the SDK that last ran pub (flutterRootin package_config.json), andflutteron thePATHwhere it is a link into an SDK — whatever their version. 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. SettingFLUTTER_ROOTto the SDK's folder always works. -
others(
{Map< String, String> ? environment}) → List<({FlutterSdk sdk, String source})> -
The Flutter SDKs on this machine besides the ones
justinstalled:FLUTTER_ROOT's, the oneflutteron thePATHis, and fvm's — each once, with where it was found. -
pinOf(
String projectRoot) → String? -
The Flutter version
projectRootpins —flutterin itsjust.json— when it names one exactly (3.47.9); null when it pins none, or itsjust.jsoncan't be read (the command that reads it next says why).