title: How can I pass variable from Future<String> to void in Flutter?
body: <p>I am using SharedPreferences i made a simple saver and getter but I want to load my variable <strong>name</strong> when opening app using initState:</p>
  
  <p><strong>data</strong> is a string with a placeholder</p>
  
  <p>Saver</p>
  
  <pre><code>Future&lt;String&gt; saveNamePreference(String name) async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    prefs.setString('name', name);
  
    print(name);
    return prefs.getString(name);
  }
  </code></pre>
  
  <p>Getter</p>
  
  <pre><code>Future&lt;String&gt; getNamePreference() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    final name = prefs.getString('name');
  
    return name.toString();
  }
  </code></pre>
  
  <p>Void initState</p>
  
  <pre><code>  @override
    void initState() async {
      super.initState();
      await getNamePreference();
      setState(() {
        data = name;
      });
    }
  </code></pre>