Home > Net >  get current app's localization and directionality in flutter
get current app's localization and directionality in flutter

Time:12-26

I want to get the app's current localization and find out the app's directionality (RTL or LTR) in the flutter class.

How can I get that?

CodePudding user response:

You can get the used Directionality from the context where you want it with:

Directionality.of(context) 

The same thing for Localizations, you can retrieve it from the context like this:

 Localizations.of(context, MaterialLocalizations);
  • Related