generate method

  1. @override
Future<void> generate(
  1. ProjectContext context
)
override

Executes the plugin's code-generation and configuration logic.

Implementation

@override
Future<void> generate(ProjectContext context) async {
  final basePath = context.projectPath;

  // 1. Generate Core Directories and Files
  await CoreStructureGenerator.generateCore(context);

  // 2. Create the features directory with a sample "home" feature
  Services.fileService.createDir('$basePath/lib/features');
  Services.fileService.createDir('$basePath/lib/features/home');
  Services.fileService.createDir('$basePath/lib/features/home/data');
  Services.fileService.createDir('$basePath/lib/features/home/domain');
  Services.fileService.createDir('$basePath/lib/features/home/presentation');
  Services.fileService.createDir('$basePath/lib/features/home/presentation/views');
  Services.fileService.createDir('$basePath/lib/features/home/presentation/${context.stateManagementFolder}');

  // Write a base placeholder readme for features
  Services.fileService.writeFile(
    '$basePath/lib/features/README.md',
    '# Features\n\nOrganize code by features (e.g. auth, home, profile). Each feature contains data, domain, and presentation layers.\n',
  );
}