2017-06-04 8 views
0

走行試験は、常にフラッターテストMissingPluginException

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

マイpubspec.yaml

dev_dependencies: 
    flutter_test: 
    sdk: flutter 

dependencies: 
    flutter: 
    sdk: flutter 
    shared_preferences: 0.2.3 

アプリケーション自体に細かな作品のコードにつながります。 プラグインを利用するテストを実行するために何か必要なものがありませんか?

答えて

2

あなたがsetMockInitialValuesを使用し、shared_preferences 0.2.4以上を使用している場合:以前のバージョンの

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