validateConfig static method

String? validateConfig(
  1. dynamic option, {
  2. required String configName,
})

Validate configuration option for Language.

Implementation

static String? validateConfig(dynamic option, {required String configName}) {
  if (option == null) return null;
  if (option is! String) {
    return "an entry in inno_bundle.languages attribute is invalid "
        "in $configName, expected a string, got $option.";
  }
  final language = Language.getByNameOrNull(option);
  if (language == null) {
    return "an option in inno_bundle.languages attribute is invalid "
        "in $configName, language `$option` is not supported.";
  }

  // If the name does not match exactly,
  // we need to notify the user of the partial match.
  if (language.name != option) {
    CliLogger.info("Language `$option` is not an exact match, "
        "it will be replaced with `${language.name}`.");
  }
  return null;
}