replaceTemplate method

void replaceTemplate(
  1. AFCommandContext context,
  2. dynamic id,
  3. AFSourceTemplate content
)

Replaces the specified id with the content of the specified source template anywhere in the file.

Implementation

void replaceTemplate(AFCommandContext context, dynamic id, AFSourceTemplate content) {
  if(content.isComment && !AFibD.config.generateBeginnerComments) {
    replaceText(context, id, "");
    return;
  }

  final idCode = id.toString();
  for(var i = 0; i < lines.length; i++) {
    replaceInLine(context, i, idCode, content.createLinesWithOptions);
  }
}