createProject method

  1. @override
Future<void> createProject(
  1. ProjectConfig config
)
override

Creates a Flutter project with the given configuration

Implementation

@override
Future<void> createProject(ProjectConfig config) async {
  await _flutterCommandDataSource.createFlutterProject(
    projectName: config.projectName,
    organizationName: config.organizationName,
    platforms: config.platforms,
    mobilePlatform: config.mobilePlatform,
    desktopPlatform: config.desktopPlatform,
    customDesktopPlatforms: config.customDesktopPlatforms,
  );

  await _fileSystemDataSource.addDependencies(
    config.projectName,
    StateManagementType.bloc,
    true,
    true,
    true
  );

  await _fileSystemDataSource.createCleanArchitectureStructure(
    config.projectName,
    StateManagementType.bloc,
    ArchitectureType.cleanArchitecture,
    includeGoRouter: true,
    includeFreezed: true,
  );

  await _fileSystemDataSource.createStateManagementTemplates(
    config.projectName,
    StateManagementType.bloc,
    true
  );

  await _fileSystemDataSource.ensureCleanArchitectureFiles(config.projectName);

  if (config.includeLinterRules) {
    await _fileSystemDataSource.createLinterRules(config.projectName);
  }

  await _fileSystemDataSource.createBuildYaml(config.projectName);

  await _fileSystemDataSource.createVSCodeLaunchConfig(config.projectName);

  await _fileSystemDataSource.createGitIgnore(config.projectName);

  await _fileSystemDataSource.createInternationalization(config.projectName);

  await _fileSystemDataSource.createBarrelFiles(
    config.projectName,
    StateManagementType.bloc,
    true,
    true
  );

  // IMPORTANTE: Primero instalar dependencias antes de generar código
  await _flutterCommandDataSource.cleanBuildCache(config.projectName);

  // Generar archivos de localización (requiere intl_utils instalado)
  await _flutterCommandDataSource.generateLocalizationFiles(config.projectName);

  // Generar archivos de Freezed y Drift (requiere build_runner instalado)
  await _flutterCommandDataSource.runBuildRunner(config.projectName);

  // Setup CocoaPods for iOS/macOS platforms
  await _flutterCommandDataSource.setupCocoaPods(config.projectName, config.platforms);
}