How can I get the variant of the language on ios?


I have my Iphone set to English (UK) and I am trying to get the UK part in my flutter ap by doing this.

final languageCode = Platform.localeName.split('_')[0]; //prints en
final countryCode = Platform.localeName.split('_')[1]; //prints NL where I want UK

But my country code is alway NL which is my region. How can I get UK?

enter image description here


Its look like you want to access ISO Country Code

You can acces your device language country code with :

//Your device's all locales
final List<Locale> systemLocales = WidgetsBinding.instance!.window.locales; 
//Your device's first(current) locale country code.
String? isoCountryCode = systemLocales.first.countryCode;

Answered By – guccisekspir

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published