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 ?


Solution 1: moneer alhashim

Unfortunately you can't do that as of yet. I've filed a feature request a while back, but they don't seem enthused about it.

You can follow up on it here: https://github.com/flutter/flutter/issues/84326