DartProject class

Encapsulates the idea of a dart project which is made up of a pubspec.yaml, dart files ....

Constructors

DartProject.fromPath(String pathToSearchFrom, {bool search = false})
Load a dart project from the given directory. We search up the tree starting from pathToSearchFrom until we find a pubspec.yaml and that becomes the project root. directory.

Properties

hasAnalysisOptions bool
Returs true if the project has an 'analyssi_options.yaml' file.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasPubSpec bool
Returns true if the project contains a pubspec.yaml.
no setter
isReadyToRun bool
there is a 'generated' date stamp in the .json file which might be more definitive. Returns true if the project is in state when any of its scripts can be run.
no setter
pathToProjectRoot String
Returns the path to the project's root diretory.
no setter
pathToPubSpec String
Returns the pat to the project's pubspec.yaml
no setter
pubSpec PubSpec
reads and returns the project's virtual pubspec and returns it.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clean() → void
Removes any of the dart build artifacts so you have a clean directory. We do this recursively so all subdirectories will also be purged.
compile({bool install = false, bool overwrite = false}) → void
Compiles all dart scripts in the project. If you setinstall to true then each compiled script is added to your PATH by copying it into ~/.dcli/bin. install defaults to false.
createScript(String scriptName, {String templateName = 'basic.dart'}) Script
Creates a script in pathToProjectRoot with the name scriptName using the based templateName which defaults to (basic.dart)
doctor() → void
Used by the dcli doctor command to print out the DartProjects details.
initFiles() → void
Prepares the project by creating a pubspec.yaml and the analysis_options.yaml file.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
warmup({bool background = false}) → void
Prepare the project so it can be run. This essentially means that we run pub get however if the project hasn't been initialised then we initialise the project as well. if background is set to true then we run the build as a background process. background defaults to false.

Operators

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

Static Properties

current DartProject
Returns the instance of the currently running DartProject.
no setter