首页 > 解决方案 > MissingPluginException(在通道 plugins.flutter.io/shared_preferences 上找不到方法 getAll 的实现)

问题描述

shared_preferences: ^0.5.3+4 已经在使用

 SharedPreferences.setMockInitialValues({});
 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;
  });

标签: flutter

解决方案


推荐阅读