更新时间:2022-10-27 12:49:25
{lc});
问题来自 void initState()语句,上下文为空,然后返回一个空字符串。
我希望有一个方法,如:平台。 isIOS
任何人都知道如何从项目的任何地方获取此语言代码。
非常感谢您。
祝你好运。
MiQi
Hello Everyone,
I would like to retrieve from my flutter/dart project, the current system lqnguage code, like. fr, en, ...
What I have tried:
I have tried the following:
Locale myLocale = Localizations.localeOf(context); String lc = currentLanguageCode(myLocale); print ("Language code: ${lc}");
The problen is from the void initState() statement, the context is null and will then return an empty string.
I was hoping to have a method like:
Platform.isIOS
Does anyonce have an idea how to grab this language code from everywhere in the project.
Thank you very much in advance.
Best regards.
MiQi
{lc}");
The problen is from the void initState() statement, the context is null and will then return an empty string.
I was hoping to have a method like:Platform.isIOS
Does anyonce have an idea how to grab this language code from everywhere in the project.
Thank you very much in advance.
Best regards.
MiQi