title: How to save List<Object> to SharedPreferences in Flutter?
body: <p>I have a list of favorite music, which I retrieve from music when the app is opened for the first time, the app gets a favorite music list from favorite. I want to save this list to shared </p>
  
  <pre><code>preferences.List&lt;Music&gt; favoriteMusic = new List&lt;Music&gt;();
  </code></pre>
  
  <p>where music class is:</p>
  
  <pre><code>class Music {
    final int id;
    final String name, size, rating, duration, img;
    bool favorite;
  
    Music({
      this.id,
      this.rating,
      this.size,
      this.duration,
      this.name,
      this.img,
      this.favorite,
    });
  
    factory Music.fromJson(Map&lt;String, dynamic&gt; jsonData){
      return Music(
        id: jsonData['id'],
        rating: jsonData['rating'],
        size: jsonData['size'],
        duration: jsonData['duration'],
        name: jsonData['name'],
        img: jsonData['img'],
        favorite: false,
      );
    }
  }
  </code></pre>
  
  <p>How can I save favorite music list?</p>