首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >shared_prefrences在apk发布模式下的颤振误差(通道插件上的getAll方法未发现实现)

shared_prefrences在apk发布模式下的颤振误差(通道插件上的getAll方法未发现实现)
EN

Stack Overflow用户
提问于 2021-01-19 12:32:22
回答 1查看 411关注 0票数 0

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类。

EN

回答 1

Stack Overflow用户

发布于 2021-02-27 14:40:46

如果您使用的是shared_preferences 0.2.4及以上版本,请使用setMockInitialValues

代码语言:javascript
运行
复制
SharedPreferences.setMockInitialValues({}); // set initial values here if desired

对于早期版本,您可以手动完成:

代码语言:javascript
运行
复制
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;
  });
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65791586

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档