How to add Localizations to a Flutter package without a MaterialApp?

744 views Asked by At

I am moving some widgets of my app into a seperated Flutter package. These widgets use AppLocalization to display localized Strings. I want to define the Strings inside the package.

In the package there is no 'entry point' in form of a MaterialApp.

Until now, I used the translations via AppLocalizations.of(context), however the context is now given by the main app. My understanding is that the app now loads the translation files defined in the app (where the context comes from) instead of the package. Is there any way how I can specify which translations to use? If not, how do you implement localized Strings inside a Flutter package, which does not contain a MaterialApp?

0

There are 0 answers