如何通过设备在抖动中的位置获取时区,语言和县ID? [英] How to get timezone, Language and County Id in flutter by the location of device in flutter?

查看:107
本文介绍了如何通过设备在抖动中的位置获取时区,语言和县ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是扑朔迷离的新手,我想在设备android或iOS上运行项目时获取时区,语言和县ID。它应该从设备的位置检测时区,语言和国家/地区ID。我是新手,不知道如何获得这些。有没有图书馆,或者我可以通过内部图书馆获得,请提出其他建议。

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 Id from the location of the device. I am newbie to flutter and don't know how can I get these. Is there any library or I can get these via the internal library, please suggest another way.

推荐答案

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


Locale myLocale =本地化。 localeOf(context);

Locale myLocale = Localizations.localeOf(context);

提供 countryCode 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

这篇关于如何通过设备在抖动中的位置获取时区,语言和县ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆