Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter LocationNotFoundException(名为“GMT”的位置不存在)_Flutter_Dart_Push Notification - Fatal编程技术网

Flutter LocationNotFoundException(名为“GMT”的位置不存在)

Flutter LocationNotFoundException(名为“GMT”的位置不存在),flutter,dart,push-notification,Flutter,Dart,Push Notification,我需要为调度创建本地通知,问题是当我使用setLocalLocation函数获取时区名称时,它等于[log]timeZoneName值为=>GMT 例外情况是: LocationNotFoundException (Location with the name "GMT" doesn't exist) const MethodChannel platform = MethodChannel('dexterx.dev/example_app'); void main() a

我需要为调度创建本地通知,问题是当我使用setLocalLocation函数获取时区名称时,它等于
[log]timeZoneName值为=>GMT

例外情况是:

LocationNotFoundException (Location with the name "GMT" doesn't exist)
const MethodChannel platform = MethodChannel('dexterx.dev/example_app');
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await _configureLocalTimeZone();
runApp(MyApp());
}
Future<void> _configureLocalTimeZone() async {
  tz.initializeTimeZones();
  final String timeZoneName = await platform.invokeMethod('getTimeZoneName');
  log("timeZoneName value is =>$timeZoneName",error: {"name":"Value or not"});
  tz.setLocalLocation(tz.getLocation(timeZoneName));
}
主要功能:

LocationNotFoundException (Location with the name "GMT" doesn't exist)
const MethodChannel platform = MethodChannel('dexterx.dev/example_app');
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await _configureLocalTimeZone();
runApp(MyApp());
}
Future<void> _configureLocalTimeZone() async {
  tz.initializeTimeZones();
  final String timeZoneName = await platform.invokeMethod('getTimeZoneName');
  log("timeZoneName value is =>$timeZoneName",error: {"name":"Value or not"});
  tz.setLocalLocation(tz.getLocation(timeZoneName));
}
\u配置本地时区功能:

LocationNotFoundException (Location with the name "GMT" doesn't exist)
const MethodChannel platform = MethodChannel('dexterx.dev/example_app');
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await _configureLocalTimeZone();
runApp(MyApp());
}
Future<void> _configureLocalTimeZone() async {
  tz.initializeTimeZones();
  final String timeZoneName = await platform.invokeMethod('getTimeZoneName');
  log("timeZoneName value is =>$timeZoneName",error: {"name":"Value or not"});
  tz.setLocalLocation(tz.getLocation(timeZoneName));
}
Future\u配置localtimezone()异步{
tz.initializeTimeZones();
最终字符串timeZoneName=await platform.invokeMethod('getTimeZoneName');
日志(“timeZoneName值=>$timeZoneName”,错误:{“名称”:“值是否”});
tz.setLocalLocation(tz.getLocation(timeZoneName));
}

您正在使用模拟器吗?默认情况下,没有设置时区。因此,您必须选择一个,以便GMT不会为空

您是否尝试更改手机设置中的时区


我当时正在开发emulator,将时区从美国改为法国后,我的应用程序就不再崩溃了。谢谢:)