AFCodeBuffer.fromGeneratePath constructor

AFCodeBuffer.fromGeneratePath(
  1. List<String> projectPath
)

Returns a code buffer containing contents of a file under the project's 'generate' subfolder.

The generate folder can contain code generation template overrides, exported using the --export-templates flag on any generate command.

Implementation

factory AFCodeBuffer.fromGeneratePath(List<String> projectPath) {
  if(!AFProjectPaths.generateFileExists(projectPath)) {
     throw AFCommandError(error: "Expected to find file at $projectPath but did not.", usage: "");
  }

  final fullPath = AFProjectPaths.generatePathFor(projectPath);
  return AFCodeBuffer.fromFullPath(projectPath, fullPath);
}