how to resolve BuildContext context widget and BuildContext in localization

Viewed 71

I have Languages class where I set my strings. However in some widgets it returns null, and crashes my app. the method is

static Languages of(BuildContext context) {
return Localizations.of<Languages>(context, Languages);

}

because of the BuildContext in widgets the context clashes or whatever it does, the strings (Languages.of(context).someString) throws null. How to avoid that without rewriting all the codes and without jsons? Thank you!

0 Answers
Related