Skip to content

MapLocalizationLoader

A LocalizationLoader which can load translations from a map.

map must map a language code to a map of translations keys mapped to translations (i.e., a map of maps).

 {
   'en': {'header':'This is a header', ...},
   'da': {'header':'Dette er en overskrift', ...},
 }
Implemented types

Constructors

MapLocalizationLoader

MapLocalizationLoader(
  1. Map<String, Map<String, dynamic>> map
)

Create a MapLocalizationLoader based on the map.

Properties

map

Map<String, Map<String, dynamic>> map
final

The map between a language code and the localizations for this language.

The localizations of a language may be nested.

Methods

load

Future<Map<String, dynamic>> load(
  1. Locale locale
)
override

Load translations for locale.

The map may be nested, in which case it is flattened into dot-separated keys when merged - see AssetLocalizations.flatten. Returning a flat Map<String, String> remains valid.