overwriteFile method

AFGeneratedFile overwriteFile(
  1. AFCommandContext context,
  2. List<String> projectPath,
  3. dynamic templateOrId, {
  4. Map<AFSourceTemplateInsertion, AFSourceTemplate>? insertions,
})

Used for generated files which always get overwritten.

Implementation

AFGeneratedFile overwriteFile(AFCommandContext context, List<String> projectPath, dynamic templateOrId, {
  Map<AFSourceTemplateInsertion, AFSourceTemplate>? insertions,
}) {
  final generated = _createFile(context, projectPath, templateOrId, AFGeneratedFileAction.overwrite);
  if(insertions != null && !context.isExportTemplates) {
    final insert = AFSourceTemplateInsertions(insertions: insertions);
    generated.performInsertions(context, insert);
  }
  return generated;
}