execute method
Future
execute(
- Project project
)
Implementation
@override
Future execute(Project project) {
if (!argResults!['override'] && !_isDirEmpty(project.dir)) {
return Future.error('The current directory is not empty. Please '
'create a new project directory, or use --override to force '
'generation into the current directory.');
}
// Validate and normalize the project name.
String projectName = path.basename(project.dir.path);
if (_validateName(projectName) != null) {
return Future.error(_validateName(projectName)!);
}
projectName = _normalizeProjectName(projectName);
_writeFile(project, '.gitignore', _gitignore, projectName);
_writeFile(project, 'bin/helloworld.dart', _helloworld, projectName);
_writeFile(project, 'pubspec.yaml', _pubspec, projectName);
project.print("running bin/helloworld.dart...");
project.print('');
runDartScript('bin/helloworld.dart', workingDirectory: project.dir.path);
return Future.value();
}