【发布时间】:2021-12-23 13:59:50
【问题描述】:
我正在使用 dart.io 包并尝试像这样使用 Platform.localeName 检测系统的当前位置
WidgetsFlutterBinding.ensureInitialized();
String defaultSystemLocale = Platform.localeName;
print('$defaultSystemLocale');
但是当我在 Chrome (Web) 中运行应用程序时,我收到了这个错误
Error: Unsupported operation: Platform._localeName
at Object.throw_ [as throw] (http://localhost:62284/dart_sdk.js:5061:11)
at Function._localeName (http://localhost:62284/dart_sdk.js:54692:17)
at Function.localeName (http://localhost:62284/dart_sdk.js:54698:71)
at Function.get localeName [as localeName] (http://localhost:62284/dart_sdk.js:54574:27)
at main (http://localhost:62284/packages/testapp/main4.dart.lib.js:97:45)
知道为什么吗?
【问题讨论】:
标签: flutter flutter-web