DartSdk class Null safety
The DartSdk provides access to a number of the dart sdk tools as well as details on the active sdk instance.
Constructors
- DartSdk()
-
factory
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- pathToDartExe → String?
-
The path to the dart exe.
Returns null if the the path cannot be foun.d
read-only
- pathToDartToNativeExe → String?
-
file path to the 'dart2native' command.
read-only
- pathToPackageConfig → String
-
returns the relative path to the packges configuration file.
For versions of dart prior to 2.10 this returns '.packages'
For versions of dart from 2.10 it returns .dart_tools/package_config.json
read-only
- pathToPubExe → String?
-
file path to the 'pub' command.
Returns null if the path cannot be found.
read-only
- pathToSdk → String
-
The path to the dart 'bin' directory.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- useDartCommand → bool
-
From 2.10 onwards we use the dart compile option rather than dart2native.
read-only
- version → String
-
Returns the DartSdk's version
read-only
- versionMajor → int
-
read-only
- versionMinor → int
-
read-only
Methods
-
getVersion(
) → Version - Returns the DartSdk's version
-
globalActivate(
String package) → void -
Run dart pub global activate on the given
package
.@Deprecated('Use PubCache().globalActivate') -
globalActivateFromPath(
String path) → void -
Run dart pub global activate for a package located in
path
relative to the current directory.@Deprecated('Use PubCache().globalActivateFromSource') -
globalDeactivate(
String package) → void -
Run dart pub global deactivate on the given
package
.@Deprecated('Use PubCache().globalDeactivate') -
installFromArchive(
String defaultDartSdkPath, {bool askUser = true}) → String -
Installs the latest version of DartSdk from the official google archives
This is simply the process of downloading and extracting the
sdk to the
defaultDartSdkPath
. [...] -
isPackageGlobalActivateFromPath(
String path) → void -
Run dart pub global activate for a package located in
path
relative to the current directory.@Deprecated('Use PubCache().isGloballyActivatedFromSource') -
isPackageGloballyActivated(
String package) → bool -
returns true if the given package has been globally activated
@Deprecated('Use PubCache().isGloballyActivated')
-
isPubGetRequired(
String workingDirectory) → bool -
Returns true if you need to run pub get.
If there is no pubspec.yaml in the workingDirectory
then an
PubspecNotFoundException
will be thrown. Running pub get is required if any of the following are older (or don't exist) than your pubspec.yaml file: pubspec.lock .dart_tool/package_config.json -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
run(
{required List< String> args, String? workingDirectory, Progress? progress, bool detached = false, bool terminal = false, bool nothrow = false}) → Progress - Run the dart exe with arguments.
-
runDartCompiler(
DartScript script, {required String pathToExe, Progress? progress, String? workingDirectory}) → void -
Run the 'dart compiler' command.
script
is the path to the dcli script we are compiling.pathToExe
is the path (including the filename) to write the compiled ex to . IfworkingDirectory
is not passed then the current working directory is used. TheworkingDirectory
should contain the pubspec.yaml that is used to compile the script. -
runPub(
{required List< String> args, String? workingDirectory, Progress? progress, bool nothrow = false}) → Progress - Runs the 'dart pub' command with the given arguments. [...]
-
runPubGet(
String? workingDirectory, {Progress? progress, bool compileExecutables = false}) → void - runs 'dart pub get'
-
runPubUpgrade(
String? workingDirectory, {Progress? progress, bool compileExecutables = false}) → void - runs 'dart pub upgrade'
-
toString(
) → String -
A string representation of this object. [...]
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
Static Properties
- dart2NativeExeName → String
-
platform specific name of the 'dart2native' executable
read-only
- dartExeName → String
-
platform specific name of the 'dart' executable
read-only
- pubExeName → String
-
platform specific name of the 'pub' executable
read-only