run function

void run(
  1. List<String> args
)

Implementation

void run(List<String> args) {
  String? src;
  String? dist;
  String? tag;
  bool nullable = false;
  bool clean = false;
  final parser = ArgParser();
  parser.addOption(
    'src',
    defaultsTo: './Jsons',
    callback: (v) => src = v,
    help: "Specify the Json directory.",
  );
  parser.addOption(
    'dist',
    defaultsTo: 'lib/models',
    callback: (v) => dist = v,
    help: "Specify the dist directory.",
  );

  parser.addOption(
    'tag',
    defaultsTo: '\$',
    callback: (v) => tag = v,
    help: "Specify the tag ",
  );

  parser.addFlag('nullable', callback: (v) => nullable = v);
  parser.addFlag('clean', callback: (v) => clean = v);

  parser.parse(args);

  if (clean) {
    br.run(['clean']);
  } else if (generateModelClass(src!, dist!, tag!, nullable: nullable)) {
    br.run(['build', '--delete-conflicting-outputs']);
  }
}