LocalizationConfig.fromJson constructor

LocalizationConfig.fromJson(
  1. Map<String, dynamic> json
)

Creates a LocalizationConfig instance from a JSON map.

This factory constructor parses a JSON map and creates a corresponding LocalizationConfig object. It expects the JSON map to contain the keys 'defaultLocale' and 'supportedLocales'. The 'supportedLocales' value should be a JSON array of strings.

Example JSON:

{
  "defaultLocale": "en_US",
  "supportedLocales": ["en", "es", "fr"]
}

Throws a TypeError if the provided JSON values are not of the expected types.

Implementation

factory LocalizationConfig.fromJson(Map<String, dynamic> json) {
  return LocalizationConfig(
    defaultLocale: json['defaultLocale'] as String,
    supportedLocales: List<String>.from(json['supportedLocales']),
  );
}