title: The return type 'Future<Image>' isn't a 'Widget', as required by the closure's context
body: <p>I'm sending login info to an api and getting a image id number that I send back to the api to get the image and i want to display the images in a grid but i'm getting a &quot;The return type 'Future' isn't a 'Widget', as required by the closure's context.&quot; error.</p>
  <p>the error is on the recentAlbumArt function</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:test_music_app/API/api_call.dart';
  
  import 'package:test_music_app/API/auth.dart';
  
  class RecentlyAddedAlbums extends StatefulWidget {
    @override
    _RecentlyAddedAlbumsState createState() =&gt; _RecentlyAddedAlbumsState();
  }
  
  class _RecentlyAddedAlbumsState extends State&lt;RecentlyAddedAlbums&gt; {
    Future&lt;List&lt;Album&gt;&gt; albums;
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Container(
          child: FutureBuilder(
              future: fetchRecentlyAddedAlbums(),
              builder: (context, AsyncSnapshot&lt;List&lt;Album&gt;&gt; data) {
                switch (data.connectionState) {
                  case ConnectionState.none:
                    return Text(
                      &quot;none&quot;,
                      style: TextStyle(color: Colors.black),
                    );
                  case ConnectionState.waiting:
                    return Center(
                        child: CircularProgressIndicator(
                      valueColor: AlwaysStoppedAnimation&lt;Color&gt;(Colors.black),
                    ));
                  case ConnectionState.active:
                    return Text('');
                  case ConnectionState.done:
                    if (data.hasData) {
                      List&lt;Album&gt; albums = data.data;
                      return ListView.builder(
                        itemCount: albums.length,
                        itemBuilder: (context, index) {
                          return FutureBuilder(
                              future: recentAlbumArt(albums[index].coverArt),
                              builder: (context, AsyncSnapshot data) {
                                switch (data.connectionState) {
                                  case ConnectionState.none:
                                    return Text(
                                      &quot;none&quot;,
                                      style: TextStyle(color: Colors.black),
                                    );
                                  case ConnectionState.waiting:
                                    return Center(
                                        child: CircularProgressIndicator(
                                      valueColor: AlwaysStoppedAnimation&lt;Color&gt;(
                                          Colors.black),
                                    ));
                                  case ConnectionState.active:
                                    return Text('');
                                  case ConnectionState.done:
                                    if (data.hasData) {
                                      return recentAlbumArt(
                                              albums[index].coverArt)
                                          .then((coverArtList) {
                                        return Image.network(coverArtList[index]);
                                      });
                                    }
                                }
                              });
                        },
                      );
                    }
                }
              }),
        ),
      );
    }
  }
  
  </code></pre>
  <p>the two functions:</p>
  <pre><code>Future&lt;List&lt;Album&gt;&gt; fetchRecentlyAddedAlbums() async {
    try {
      var salt = randomToken(6);
      var token = makeToken(&quot;$password&quot;, &quot;$salt&quot;);
      var uRL =
          &quot;$server/rest/getAlbumList?u=$username&amp;t=$token&amp;s=$salt&amp;v=$tapeOutVerison&amp;c=$client$format&amp;type=newest&quot;;
      var authresponse = await http.get(uRL);
      if (authresponse.statusCode == 200) {
        var jsondata = jsonDecode(authresponse.body);
        var data = apicallFromJson(jsondata);
        var aresponse = data.subsonicResponse.albumList.album;
        return aresponse;
      } else {
        return null;
      }
    } catch (e) {
      return null;
    }
  }
  
  //TODO: build the cover art fetching within the album list or build it outside
  Future recentAlbumArt(String coverArtID) async {
    try {
      var salt = randomToken(6);
      var token = makeToken(&quot;$password&quot;, &quot;$salt&quot;);
      var uRL =
          &quot;$server/rest/getCoverArt/?u=$username&amp;t=$token&amp;s=$salt&amp;v=$tapeOutVerison&amp;c=$client$format&amp;id=$coverArtID&quot;;
      var coverArtList = await http.get(uRL);
      return coverArtList;
    } catch (e) {
      print(e);
    }
  }
  </code></pre>