validateFlavorReadyToRun method

bool validateFlavorReadyToRun(
  1. FlavorConfig config,
  2. String flavor,
  3. AppLogger log
)

Validates that both the .env file and entry-point file exist for flavor. Logs errors via log and returns false if either is missing.

Implementation

bool validateFlavorReadyToRun(
  FlavorConfig config,
  String flavor,
  AppLogger log,
) {
  final envFile = File('.env.$flavor');
  if (!envFile.existsSync()) {
    log.error(
      '❌ Error: Missing .env.$flavor file. Run "init" or "setup" to regenerate it.',
    );
    return false;
  }

  final targetPath = config.useSeparateMains
      ? 'lib/main/main_$flavor.dart'
      : 'lib/main.dart';
  if (!File(targetPath).existsSync()) {
    log.error('❌ Error: Entry point not found: $targetPath');
    return false;
  }

  return true;
}