fromMap static method

RawConfig fromMap(
  1. Map<String, dynamic> map
)

Parses the config entry

Implementation

static RawConfig fromMap(Map<String, dynamic> map) {
  return RawConfig(
    baseLocale: I18nLocale.fromString(
        map['base_locale'] ?? RawConfig.defaultBaseLocale),
    fallbackStrategy:
        (map['fallback_strategy'] as String?)?.toFallbackStrategy() ??
            RawConfig.defaultFallbackStrategy,
    inputDirectory:
        (map['input_directory'] as String?)?.removeTrailingSlash() ??
            RawConfig.defaultInputDirectory,
    inputFilePattern:
        map['input_file_pattern'] ?? RawConfig.defaultInputFilePattern,
    outputDirectory:
        (map['output_directory'] as String?)?.removeTrailingSlash() ??
            RawConfig.defaultOutputDirectory,
    outputFileName:
        map['output_file_name'] ?? RawConfig.defaultOutputFileName,
    outputFormat: (map['output_format'] as String?)?.toOutputFormat() ??
        RawConfig.defaultOutputFormat,
    localeHandling: map['locale_handling'] ?? RawConfig.defaultLocaleHandling,
    flutterIntegration:
        map['flutter_integration'] ?? RawConfig.defaultFlutterIntegration,
    namespaces: map['namespaces'] ?? RawConfig.defaultNamespaces,
    translateVar: map['translate_var'] ?? RawConfig.defaultTranslateVar,
    enumName: map['enum_name'] ?? RawConfig.defaultEnumName,
    className: map['class_name'] ?? RawConfig.defaultClassName,
    translationClassVisibility:
        (map['translation_class_visibility'] as String?)
                ?.toTranslationClassVisibility() ??
            RawConfig.defaultTranslationClassVisibility,
    keyCase: (map['key_case'] as String?)?.toCaseStyle() ??
        RawConfig.defaultKeyCase,
    keyMapCase: (map['key_map_case'] as String?)?.toCaseStyle() ??
        RawConfig.defaultKeyMapCase,
    paramCase: (map['param_case'] as String?)?.toCaseStyle() ??
        RawConfig.defaultParamCase,
    stringInterpolation:
        (map['string_interpolation'] as String?)?.toStringInterpolation() ??
            RawConfig.defaultStringInterpolation,
    renderFlatMap: map['flat_map'] ?? RawConfig.defaultRenderFlatMap,
    translationOverrides:
        map['translation_overrides'] ?? RawConfig.defaultTranslationOverrides,
    renderTimestamp: map['timestamp'] ?? RawConfig.defaultRenderTimestamp,
    renderStatistics: map['statistics'] ?? RawConfig.defaultRenderStatistics,
    maps: map['maps']?.cast<String>() ?? RawConfig.defaultMaps,
    pluralAuto: (map['pluralization']?['auto'] as String?)?.toPluralAuto() ??
        RawConfig.defaultPluralAuto,
    pluralParameter:
        (map['pluralization']?['default_parameter'] as String?) ??
            RawConfig.defaultPluralParameter,
    pluralCardinal: map['pluralization']?['cardinal']?.cast<String>() ??
        RawConfig.defaultCardinal,
    pluralOrdinal: map['pluralization']?['ordinal']?.cast<String>() ??
        RawConfig.defaultOrdinal,
    contexts: (map['contexts'] as Map<String, dynamic>?)?.toContextTypes() ??
        RawConfig.defaultContexts,
    interfaces:
        (map['interfaces'] as Map<String, dynamic>?)?.toInterfaces() ??
            RawConfig.defaultInterfaces,
    obfuscation: (map['obfuscation'] as Map<String, dynamic>?)
            ?.toObfuscationConfig() ??
        RawConfig.defaultObfuscationConfig,
    imports: map['imports']?.cast<String>() ?? RawConfig.defaultImports,
    rawMap: map,
  );
}