I added l10n to my flutter app as suggested in the flutter docs, it is suggested to get the localizations with a static method like this:
static DemoLocalizations of(BuildContext context) {
return Localizations.of<DemoLocalizations>(context, DemoLocalizations);
}
This works fine when running the app, but when I try to test my widgets, the returned value is always null.
Is there any easy way to provide the localizations within the tests?
For now I'm passing through the localizations via DI, but it is quite an overhead.
await tester.pumpAndSettle();
to achieve this. – Interpret