add method
Generate a new feature template with the given featureName.
Detects the state management used in the project and generates the appropriate template. Runs build_runner after generation.
Implementation
Future<void> add(String featureName) async {
logger.info('\n📦 Generating new feature template...');
final root = findFlutterProjectRoot();
final currentStateManagement = await detectStateManagementFromProject(root);
final architecture = await detectArchitectureFromProject(
root: root,
stateManagement: currentStateManagement,
);
await FileGenerator.generateFeature(
stateManagement: currentStateManagement,
featureName: featureName,
architecture: architecture,
);
logger.success('\n✅ $featureName template already generated!');
await runBuildRunner(projectRoot: root);
}