ReleasePackerDartBuildCli constructor

ReleasePackerDartBuildCli(
  1. String target, {
  2. String? output,
  3. List<String>? args,
  4. bool launcher = false,
})

The output must be relative to the root directory: the bundle is mapped from it. The args can't set the target or the output: use target and output.

Implementation

factory ReleasePackerDartBuildCli(
  String target, {
  String? output,
  List<String>? args,
  bool launcher = false,
}) {
  var outputPath = normalizeOutput(output ?? defaultOutput(target));

  var reserved = args?.firstWhereOrNull(_isReservedArg);
  if (reserved != null) {
    throw ArgumentError(
      "`dart_build_cli` arguments can't set the target or the output "
      "(use `target` and `output`): $reserved",
    );
  }

  return ReleasePackerDartBuildCli._(target, outputPath, args, launcher);
}