How to get timezone, Language and County Id in flutter by the location of device in flutter?

后端 未结 7 757
长情又很酷
长情又很酷 2020-12-24 10:59

I am new to flutter, and I want to get Timezone, language, and county Id when I run my project on my device android or iOS. It should detect Timezone, language and country I

7条回答
  •  庸人自扰
    2020-12-24 11:39

    https://flutter.io/tutorials/internationalization/#tracking-locale

    Locale myLocale = Localizations.localeOf(context);

    provides countryCode and languageCode

    https://docs.flutter.io/flutter/dart-ui/Locale-class.html

    The timezone should be available with (not tried)

    DateTime.now().timeZoneName
    

    https://docs.flutter.io/flutter/dart-core/DateTime-class.html

提交回复
热议问题