keys property
Overrides the keys getter from Translations
to provide the
combined translation keys.
This method iterates through the list of translation maps, combines them, and returns a single map of keys that will be used for translations in the application.
Implementation
@override
Map<String, Map<String, String>> get keys {
var combinedKeys = <String, Map<String, String>>{};
for (var map in translations) {
map.forEach((key, value) {
if (combinedKeys.containsKey(key)) {
combinedKeys[key] = {...combinedKeys[key]!, ...value};
} else {
combinedKeys[key] = value;
}
});
// print('translations = ${JsonEncoder().convert(translations)}');
}
return combinedKeys;
}