Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current country code in flutter

I have already tried to get current country code via this. Give me best solution for same.

I want to show country flag on the Splash page, So I need to know about user country and This is required for me.

Please help me guys

like image 738
Akshay Jaiswal Avatar asked Dec 19 '19 11:12

Akshay Jaiswal


2 Answers

It's enough

WidgetsBinding.instance.window.locale.countryCode
like image 109
Raveesh G S Avatar answered Sep 22 '22 17:09

Raveesh G S


You can use system locales.

final List<Locale> systemLocales = WidgetsBinding.instance.window.locales;
String isoCountryCode = systemLocales.first.countryCode;
like image 25
Ramis Avatar answered Sep 23 '22 17:09

Ramis