title: Flutter: testing shared preferences
body: <p>I'm trying to test this function:</p>
  
  <pre><code> void store(String x, String y) async {
      Map&lt;String, dynamic&gt; map = {
        'x': x,
        'y': y,
      };
      var jsonString = json.encode(map);
      SharedPreferences prefs = await SharedPreferences.getInstance();
      prefs.setString('fileName', jsonString);
    }
  </code></pre>
  
  <p>I saw that I can populate the shared preferences with </p>
  
  <pre><code>const MethodChannel('plugins.flutter.io/shared_preferences')
    .setMockMethodCallHandler((MethodCall methodCall) async {
      if (methodCall.method == 'getAll') {
        return &lt;String, dynamic&gt;{}; // set initial values here if desired
      }
      return null;
    });
  </code></pre>
  
  <p>But I didn't understand how to use, expecially in my case. </p>