pubspecBuilder function

Builder pubspecBuilder(
  1. BuilderOptions options
)

Implementation

Builder pubspecBuilder(BuilderOptions options) {
  final pubspec = loadYaml(File('pubspec.yaml').readAsStringSync()) as Map;

  var options = GeneratorOptions.def;

  if (pubspec.containsKey('pubspec_extract')) {
    final opt = pubspec['pubspec_extract'] as Map;
    options = options.copyWith(
      className: opt['class_name'],
      mapList: opt['map_list'],
      source: opt['source'],
      destination: opt['destination'],
      format: opt['format'],
    );
  }

  return MyBuilder(options);
}