我在Flutter中使用sharedPreferences时,控制台反复报这样的bug?

When I use sharedPreferences in Flutter ,the console reported bugs like this repeatedly?

Error: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
    at Object.throw_ [as throw] (http://localhost:64672/dart_sdk.js:5348:11)
    at MethodChannel._invokeMethod (http://localhost:64672/packages/flutter/src/services/system_channels.dart.lib.js:962:21)
    at _invokeMethod.next (<anonymous>)
    at http://localhost:64672/dart_sdk.js:39230:33
    at _RootZone.runUnary (http://localhost:64672/dart_sdk.js:39087:58)
    at _FutureListener.thenAwait.handleValue (http://localhost:64672/dart_sdk.js:34073:29)
    at handleValueCallback (http://localhost:64672/dart_sdk.js:34633:49)
    at Function._propagateToListeners (http://localhost:64672/dart_sdk.js:34671:17)
    at _Future.new.[_completeWithValue] (http://localhost:64672/dart_sdk.js:34513:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:64672/dart_sdk.js:34536:35)
    at Object._microtaskLoop (http://localhost:64672/dart_sdk.js:39374:13)
    at _startMicrotaskLoop (http://localhost:64672/dart_sdk.js:39380:13)
    at http://localhost:64672/dart_sdk.js:34887:9

但是我的程序可以运行顺利,而且使用的sharedpreferences也很好用。我认为多次出现可以归因于我多次使用sharedPreferences。 shared_preference 依赖的版本是否专门针对此错误?
我的版本是: shared_preferences: ^0.4.2
谁能解决这个问题,谢谢。

早期版本可以手动初始化Doc:

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;
  });