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 pubspecPath = '${context.projectPath}/pubspec.yaml';

  // 1. Add GetX dependency
  Services.yamlService.addDependency(pubspecPath, 'get', '^4.6.6');

  // 2. Register Main entry replacements for GetX if not using GoRouter
  if (!context.useGoRouter) {
    final currentImports = context.templateReplacements['STATE_MANAGEMENT_IMPORTS'] ?? '';
    context.templateReplacements['STATE_MANAGEMENT_IMPORTS'] =
        "${currentImports}import 'package:get/get.dart';\n";
  }
}