Config.fromFile constructor

Config.fromFile(
  1. File pubspecFile,
  2. File configFile,
  3. File innoExec,
  4. InnoBundleCliConfig cliConfig, {
  5. List<String> outputDir = installerBuildDir,
  6. Directory? baseDir,
})

Creates a Config instance directly from the pubspec.yaml file and a config file (if provided).

Provides a convenient way to load configuration without manual JSON parsing.

innoExec carries the resolved ISCC.exe File for this build, so the installer builder knows which Inno Setup to use.

Implementation

factory Config.fromFile(
  File pubspecFile,
  File configFile,
  File innoExec,
  InnoBundleCliConfig cliConfig, {
  List<String> outputDir = installerBuildDir,
  Directory? baseDir,
}) {
  final pubspecJson = readYaml(pubspecFile);
  final configJson =
      configFile == pubspecFile ? pubspecJson : readYaml(configFile);

  return Config.fromJson(
    pubspecJson,
    configJson,
    cliConfig: cliConfig,
    pubspecFile: pubspecFile,
    configFile: configFile,
    outputDir: outputDir,
    innoExec: innoExec,
    baseDir: baseDir,
  );
}