Flutter get localized String by ID

Viewed 95

I followed the flutter I10n tutorial and I am using .arb files for localized strings, and it works perfect for things like this:

AppLocalizations.of(context)!.message

But how can I get a String by its ID, when I have that string in a variable? So I need something like this:

String txtToTranslate = "message";
AppLocalizations.of(context)!.get(txtToTranslate);

but this doesn't exist (at least not to my knowledge). How should I do this?

0 Answers
Related