在初始化工作管理器并创建任一任务后,如果我们在任务执行中使用任何插件,则无法识别并抛出错误,如下所示 MissingPluginException(在通道 lyokone/location 上找不到方法 getLocation 的实现)
实际代码:
Workmanager.executeTask((task, inputData) async {
Location locationObject = Location();
locationObject.getLocation();
print(locationObject);
return Future.value(true);
}
Run Code Online (Sandbox Code Playgroud)
基本上,工作管理器任务中使用的任何其他插件似乎都无法识别。
我错过了什么,我需要重新注册我的所有插件吗?
I/flutter (16120): Location permission has error
I/flutter (16120): MissingPluginException(No implementation found for method serviceEnabled on channel lyokone/location)