createScript method

Script createScript(
  1. String scriptName, {
  2. String templateName = 'basic.dart',
})

Creates a script in pathToProjectRoot with the name scriptName using the based templateName which defaults to (basic.dart)

The scriptName MUST end in .dart otherwise a DartProjectException is thrown

The templateName must be the name of a template file in the ~/.dcli/template directory.

Implementation

Script createScript(String scriptName, {String templateName = 'basic.dart'}) {
  if (!scriptName.endsWith('.dart')) {
    throw DartProjectException('scriptName must end with .dart');
  }
  _createFromTemplate(
    templatePath: join(Settings().pathToTemplate, templateName),
    pathToScript: join(pathToProjectRoot, scriptName),
  );

  return Script.fromFile(scriptName, project: this);
}