execute function Null safety

void execute(
  1. List<String> args
)

Implementation

void execute(List<String> args) {
  ArgParser argParser = ArgParser();
  argParser.addMultiOption('processors',
      abbr: 'p', allowed: Processor.defaultInstructionSet, splitCommas: true);
  ArgResults results = argParser.parse(args);
  List<String> argProcessors = results['processors'];

  Parser parser = Parser(file: 'pubspec.yaml');

  Pubspec? pubspec;
  try {
    pubspec = parser.parse();
  } catch (e) {
    stderr.writeln(e);
    exit(0);
  }

  if (argProcessors.isNotEmpty) {
    pubspec.flavorizr.instructions = argProcessors;
  }

  Processor processor = Processor(pubspec);
  processor.execute();
}