I'm trying to do a list of item from Firebase Firestore (this is done) and to get for each item a different image URL from Firebase Cloud Storage.

I use a function called **getPhotoUrl** to change the value of the variable photoUrl. The problem is that the **return** is executed before **getPhotoUrl**. If I add **await** in front of the function **getPhotoUrl** and **async** after **\_docs.map((document)**, I got an error saying that *The argument type 'List<Future>' can't be assigned to the parameter type 'List'*.

My code:

```
class PhotosList extends StatefulWidget {
  @override
  _PhotosListState createState() => _PhotosListState();
}

class _PhotosListState extends State<PhotosList> {
  String photoUrl = 'lib/assets/default-image.png';
  List<DocumentSnapshot> _docs;

  getPhotoUrl(documentID) {
    Reference ref = storage
        .ref('Users')
        .child(currentUser.uid)
        .child('Photos')
        .child(documentID)
        .child('image_1.jpg');
    ref.getDownloadURL().then((value) {
      setState(() {
        photoUrl = value.toString();
      });
    }).catchError((e) {
      setState(() {
        print(e.error);
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return StreamBuilder(
      stream: firestore
          .collection('Users')
          .doc(currentUser.uid)
          .collection('Photos')
          .orderBy('date')
          .snapshots(),
      builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
        if (!snapshot.hasData) return CircularProgressIndicator();
        _docs = snapshot.data.docs;
        if (_docs.isEmpty)
          return Center(
              child: Text("The list is empty."));
        return Container(
          child: ResponsiveGridList(
            desiredItemWidth: 100,
            squareCells: true,
            minSpacing: 5,
            children: _docs.map((document) {
              getPhotoUrl(document.id);
              return PhotosListItem(photoUrl: photoUrl);
            }).toList(),
          ),
        );
      },
    );
  }
}

```