ProjectAgent constructor
ProjectAgent(})
Creates a new package and terminal on that package's working directory.
Make sure to call tearDownAll in your test's method of the same name to delete the projectsDirectory ]where the package is written to. ('$PWD/tmp')
Both dependencies
and devDependencies
are a valid dependency map,
e.g. {"aqueduct": "^3.0.0"}
or {"relative" : {"path" : "../"}}
Implementation
ProjectAgent(this.name,
{Map<String, dynamic> dependencies = const {},
Map<String, dynamic> devDependencies = const {}})
: super(Directory.fromUri(projectsDirectory.uri.resolve('$name/'))) {
if (!projectsDirectory.existsSync()) {
projectsDirectory.createSync();
}
workingDirectory.createSync(recursive: true);
final libDir = Directory.fromUri(workingDirectory.uri.resolve('lib/'));
libDir.createSync(recursive: true);
addOrReplaceFile('analysis_options.yaml', _analysisOptionsContents);
addOrReplaceFile('pubspec.yaml', _pubspecContents(name, dependencies, devDependencies));
addOrReplaceFile('lib/$name.dart', '');
}