未处理的异常:MissingPluginException

时间:2020-01-22 10:12:11

标签: flutter dart

我正在使用shared_preferences:^ 0.5.6。当我在workmanager中调用共享首选项时,出现以下错误。

Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)

请帮助。谢谢。

3 个答案:

答案 0 :(得分:1)

如果您使用的是shared_preferences 0.2.4及更高版本,请使用setMockInitialValues:

SharedPreferences.setMockInitialValues({}); // set initial values here if desired

原始答案link

答案 1 :(得分:0)

您是否可以运行flutter clean,然后从模拟器或设备上卸载该应用并再次运行

答案 2 :(得分:0)

我遇到了同样的错误 我在 yamal 文件中有 flutter_facebook_login: ^3.0.0 其中有一些 nullsafety 预防 所以要么你升级你的sdk,但对我来说

当我降级 facebookplugin 时它工作正常 谢谢