validate method

List<String> validate()

Validates the configuration and returns a list of validation errors.

Checks for:

  • Empty or invalid project name
  • Missing required directories
  • Invalid path formats

Implementation

List<String> validate() {
  final errors = <String>[];

  if (projectName.isEmpty) {
    errors.add('Project name cannot be empty');
  }

  if (!RegExp(r'^[a-zA-Z][a-zA-Z0-9_]*$').hasMatch(projectName)) {
    errors.add('Project name must be a valid Dart identifier');
  }

  if (pubspecDir.isEmpty) {
    errors.add('Pubspec directory cannot be empty');
  }

  if (outputDir.isEmpty) {
    errors.add('Output directory cannot be empty');
  }

  if (assetsDir.isEmpty) {
    errors.add('Assets directory cannot be empty');
  }

  return errors;
}