title: Flutter Spotify - How to get recommendations based on seeds
body: <p>Using the Flutter Package <a href="https://pub.dev/packages/spotify#-readme-tab-" rel="nofollow noreferrer">spotify-dart</a>, I'm trying to get track recommendations based on songs the user has in their playlist.</p>
  
  <p>Code so far:</p>
  
  <pre><code>  // Function that returns a list of recommendation tracks
    void getRecommendations() {
      List&lt;RecommendationsSeed&gt; _seeds = List&lt;RecommendationsSeed&gt;();
      Recommendations _recommendations = Recommendations();
      Map&lt;String, dynamic&gt; _json;
  
      _json = {
        // I would like to use this song(Photograph - Ed Sheeran) as a seed 
        'id': 'spotify:track:6XLww4MprrLCvWpVXD9K7S',
        'type': 'track'
      };
  
      _seeds.add(RecommendationsSeed.fromJson(_json));
  
      _recommendations.seeds = _seeds;
  
      List&lt;TrackSimple&gt; _tracks = _recommendations.tracks;
  
      _tracks.forEach((element) {
        print(element.name);
      });
  
    }
  </code></pre>
  
  <p>However, <code>_tracks</code> remains null, and thus I get an error saying <code>NoSuchMethodError: The method 'forEach' was called on null.</code></p>
  
  <p>I guess my implementation of adding seeds is wrong. What would be the proper way to get recommendations from seeds?</p>