StringResBuilder constructor

StringResBuilder(
  1. BuilderOptions options
)

Implementation

StringResBuilder(BuilderOptions options) {
  if (options.config.isEmpty) {
    return;
  }

  final inputPath = options.config["input_path"] as Map?;
  stringResPathMap = inputPath
      ?.map((key, value) => MapEntry(key as String, value as String));
  genCodeDir = options.config["output_dir"] as String? ?? "lib/res_gen/";
  defaultLang = options.config["default_lang"] as String? ?? "en";
  onlyGenKey = options.config["only_gen_key"] as bool? ?? false;
  assert(stringResPathMap?[defaultLang] != null,
      "there is no path for default language");

  if (!genCodeDir.endsWith("/")) {
    genCodeDir += "/";
  }
}