generateFile method
Generates a File in the lib directory of a flutter app.
name
- The name of the file to be generated
content
- The template code content to write to the file
directory
- Possible directory or directories to create along with the file
Implementation
void generateFile(String name, String content, String directory) {
new File('lib/' +
(directory == EMPTY_STRING ? EMPTY_STRING : directory) +
name +
'.dart')
.create(recursive: true)
.then((File file) {
file.writeAsStringSync(content);
});
VerboseLogger.logGeneratedFile(name, directory);
}