createFile method

AFGeneratedFile createFile(
  1. List<String> projectPath,
  2. AFFileSourceTemplate template, {
  3. AFSourceTemplateInsertions? extend,
  4. Map<AFSourceTemplateInsertion, Object>? insertions,
})

Creates a file from the specified template at the specified path, with the specified insertions replaced.

Implementation

AFGeneratedFile createFile(
  List<String> projectPath,
  AFFileSourceTemplate template, {
    AFSourceTemplateInsertions? extend,
    Map<AFSourceTemplateInsertion, Object>? insertions
  })  {
  var fullInsert = this.coreInsertions;
  if(insertions != null) {
    fullInsert = fullInsert.reviseAugment(insertions);
  }
  if(extend != null) {
    fullInsert = fullInsert.reviseAugment(extend.insertions);
  }
  final originalEmbedded = template.embeddedInsertions?.insertions;
  if(originalEmbedded != null) {
    fullInsert = fullInsert.reviseAugment(originalEmbedded);
  }

  return generator.createFile(this, projectPath, template, insertions: fullInsert);
}