Home > Blockchain >  If statement in .arb files
If statement in .arb files

Time:08-05

I have a problem with my mobile application. I developed my application with flutter and implemented Flutter Internationalization. After creating files with .arb extension I wanted to be able to choose the file by platform ( IOS or Android ) as well as language . Is it possible to use an If statement in the files with .arb extension? Are there any solutions for this problem of mine?

CodePudding user response:

You can put that condition in dart file also.

For ex., Platform.isAndroid ? "Localization string 1" : "Localization string 2"

CodePudding user response:

Just do that in your dart file, like this:

child: Platform.isAndroid 
  ? Text(AppLocalizations.of(context)!.stringForAndroid) 
  : Text(AppLocalizations.of(context)!.otherString)
  • Related