DartSdk class
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.
no setterinherited
- pathToDartExe → String?
-
The path to the dart exe.
Returns null if the the path cannot be foun.d
no setter
- pathToDartToNativeExe → String?
-
file path to the 'dart2native' command.
no setter
- 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
no setter
- pathToPubExe → String?
-
file path to the 'pub' command.
Returns null if the path cannot be found.
no setter
- pathToSdk → String
-
The path to the dart 'bin' directory.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- useDartCommand → bool
-
From 2.10 onwards we use the dart compile option rather than dart2native.
no setter
- useDartDocCommand → bool
-
no setter
- version → String
-
Returns the DartSdk's version
no setter
- versionMajor → int
-
no setter
- versionMinor → int
-
no setter
Methods
-
getVersion(
) → Version - Returns the DartSdk's version
-
globalActivate(
String package) → void -
Run dart pub global activate on the given
package
. -
globalActivateFromPath(
String path) → void -
Run dart pub global activate for a package located in
path
relative to the current directory. -
globalDeactivate(
String package) → void -
Run dart pub global deactivate on the given
package
. -
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. -
isPackageGloballyActivated(
String package) → bool - returns true if the given package has been globally activated
-
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 nonexistent 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. -
runDartDoc(
{String? pathToProject, String? pathToDoc, List< String> args = const [], Progress? progress, bool nothrow = false}) → Progress - Runs the 'dart doc' command with the given arguments.
-
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
no setter
- dartExeName → String
-
platform specific name of the 'dart' executable
no setter
- pubExeName → String
-
platform specific name of the 'pub' executable
no setter