Dart dynamically access getters

Viewed 139

The generated AppLocalizations in flutter has many getters

final appLocalizations = AppLocalizations.of(context)!;
print(appLocalizations.helloWorld);

I have a use case that the getter keys is stored in a List<String> and I need to translate them

const key = 'helloWorld';
print(appLocalizations[key]);

How I can access to the getter by a String variable like key ?

1 Answers
Related