title: Using The Shared Preferences Package for Data Persistance
body: <p>I am coding a relatively simple app where one can set an emergency contact and in case of emergency, a text is sent to the contact by the touch of a remote button (connected via Bluetooth.) I have used the package contact picker and it works perfectly. Now, the issue is that I'm trying to save the contact locally for when the app is relaunched. The set state line returns an error that I cannot set contact to type string.</p>
  <pre><code>final ContactPicker _contactPicker = new ContactPicker();
  Contact _contact;
  @override
  void initState() {
    getData();
  }
  
  getData() async {
    SharedPreferences prefs = await SharedPreferences.getInstance();
    setState(() {
      _contact = prefs.getString(_contact.toString());
    });
  }```
  </code></pre>