shared_preferences:^0.5.12+4
错误日志: MissingException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
颤振sdk详细信息:
✓Flutter (频道稳定,1.22.5,Mac 10.14.6 18G7016达尔文-x64,locale en-US)·颤振版本1.22.5 at /User/taleb/Developer/ Flutter·Framework修订版7891006299 (6周前),2020-12-10 11:54:40 -0800·Engine ae90085a84·Dart版本2.10.4✓Android工具链-为Android设备开发(Android版本30.0.3)·Android at /Users/taleb/Library/Android/sdk·平台android-30,build 30.0.3·ANDROID_HOME =/User/taleb/Library/ Android /sdk·Java二进制文件: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java·Java版本OpenJDK运行时环境(Build1.8.0_242-Release-1644-b3-6915495)·所有安卓许可被接受。好了!Xcode -用于iOS和macOS✗的Xcode安装是不完整的;完全安装是iOS开发所必需的。下载网址:https://developer.apple.com/xcode/download/或通过App安装Xcode。一旦安装好,运行: sudo xcode--select--开关/应用程序/xcode.app/Content/Developer sudo xcodebuild -runFirstLaunch·CocoaPods version 1.8.3✓Android (Version4.1)·Android at /AndroidStudio.app/Content·Flutter插件安装版本201.9317·OpenJDK运行时环境(Build1.8.0_242-Release-1644-b3-6915495)✓IntelliJ IDEA终极版(版本2019.3)·IntelliJ at /IntelliJ IDEA.app·Flutter插件版本45.1。2·Dart插件版本193.7547✓连接设备(1可用)·SM R9AM905ZREJ (移动)·R9AM905ZREJ·Android·Android10 (API 29)
好了!医生发现的问题有1类。
发布于 2021-02-27 14:40:46
如果您使用的是shared_preferences 0.2.4及以上版本,请使用setMockInitialValues
SharedPreferences.setMockInitialValues({}); // set initial values here if desired对于早期版本,您可以手动完成:
const MethodChannel('plugins.flutter.io/shared_preferences')
.setMockMethodCallHandler((MethodCall methodCall) async {
if (methodCall.method == 'getAll') {
return <String, dynamic>{}; // set initial values here if desired
}
return null;
});https://stackoverflow.com/questions/65791586
复制相似问题