DartProject class

Constructors

DartProject.create({required String pathTo, required String templateName})
Create a dart project on the file system at pathTo from the template named templateName.
factory
DartProject.fromCache(String name, String version)
Loads the project from the dart pub cache named name for the version version. e.g. ~/.pub-cache/hosted/pub.dartlang.org/dswitch-4.0.1
DartProject.fromPath(String pathToSearchFrom, {bool search = true})
Load a dart project from the given directory.

Properties

hasAnalysisOptions bool
Returns true if the project has an 'analysis_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
isFlutterProject bool
Returns true if this project is a flutter projects.
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
pathToAnalysisOptions String
Absolute pathto the project's analysis_options.yaml
no setter
pathToBinDir String
Absolute path to the project's 'bin' directory.
no setter
pathToDartToolDir String
Absolute path to the project's '.dart_tool' directory.
no setter
pathToDartToolPackageConfig String
Absolute path to the project's '.dart_tool/package_config.json' directory.
no setter
pathToExampleDir String
Absolute path to the project's 'example' directory.
no setter
pathToLibDir String
Absolute path to the project's 'lib' directory.
no setter
pathToLibSrcDir String
Absolute path to the project's 'lib/src' directory.
no setter
pathToProjectRoot String
Absolute path to the project's root diretory.
no setter
pathToPubSpec String
Absolute pathto the project's pubspec.yaml
no setter
pathToPubSpecLock String
Absolute pathto the project's pubspec.lock
no setter
pathToTestDir String
Absolute path to the project's 'test' directory.
no setter
pathToToolDir String
Absolute path to the project's 'tool' directory.
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 set install to true then each compiled script is added to your PATH by copying it into ~/.dcli/bin. install defaults to false.
doctor() → void
Used by the dcli doctor command to print out the DartProjects details.
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, bool upgrade = 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
If you
no setter
self DartProject
Returns the instance of the currently running DartProject.
no setter

Static Methods

findProject(String pathToSearchFrom, {bool search = true}) DartProject?
Looks for a pubspec.yaml and if found returns a DartProject.