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
@Throwing(ArgumentError)
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.
@Throwing(ArgumentError)
@Throwing(Exception)
@Throwing(FileSystemException)
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.
@Throwing(ArgumentError)
@Throwing(core.DCliException)
@Throwing(FormatException)
no setter
- useDartDocCommand → bool
-
@Throwing(ArgumentError)
@Throwing(core.DCliException)
@Throwing(FormatException)
no setter
- version → String
-
Returns the DartSdk's version
@Throwing(ArgumentError)
@Throwing(core.DCliException)
no setter
- versionMajor → int
-
@Throwing(ArgumentError)
@Throwing(core.DCliException)
no setter
- versionMinor → int
-
@Throwing(ArgumentError)
@Throwing(core.DCliException)
no setter
Methods
-
getVersion(
) → Version - Returns the DartSdk's version Throws DCliException. @Throwing(ArgumentError) @Throwing(core.DCliException)
-
hasBuildHooks(
DartScript script) → bool - Whether the script's resolved packages contain build hooks.
-
installFromArchive(
String defaultDartSdkPath, {bool askUser = true}) → Future< 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. -
isPubGetRequired(
String workingDirectory) → bool -
Returns true if you need to run pub get.
If there is no pubspec.yaml in the workingDirectory
then an
PubspecNotFoundExceptionwill 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
-
resolveArchitecture(
) → String - Converts the kernel architecture into one of the architecture names use by: https://dart.dev/tools/sdk/archive Throws OSError. @Throwing(OSError)
-
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. Throws DCliException. @Throwing(core.DCliException)
-
runDartCompiler(
DartScript script, {required String pathToExe, Progress? progress, String? workingDirectory, bool packed = false}) → CompiledExecutable -
Run the 'dart compiler' command.
scriptis the path to the dcli script we are compiling.pathToExeis the path (including the filename) to write the compiled ex to . IfworkingDirectoryis not passed then the current working directory is used. TheworkingDirectoryshould contain the pubspec.yaml that is used to compile the script. Returns the executable and its bundled libraries. Use CompiledExecutable.install to relocate them together. Throws DCliException. @Throwing(core.DCliException) -
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' @Throwing(core.DCliException)
-
runPubUpgrade(
String? workingDirectory, {Progress? progress, bool compileExecutables = false}) → void - runs 'dart pub upgrade' @Throwing(core.DCliException)
-
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
- isUsingDartFromFlutter → bool
-
no setter
- pubExeName → String
-
platform specific name of the 'pub' executable
no setter