How to send Firebase authentication token to backend when downloading image in Flutter

I've a Flutter app that uses Firebase authentication and this works. I need to retrieve images from a backend, but they require authorization so I need to send the Firebase authToken as Authorization Header. I have problems getting the Firebase authToken so I can set this to a CachedNetworkImage.

I'm new with Flutter, it's specific to Flutter, because I do have this working in iOS-Swift.

I have successfully retrieved the image when I hard code the correct authToken. This proves my backend is working correctly.

I can also retrieve the authToken asynchronously, but I can't connect this to the CachedNetworkImage.

This is working

class RemoteImage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

    String tripId = 'TXt1XIvqUDzBP6T11xTF';
    String url = 'http://localhost:8080/api/trips/$tripId/images/$tripId.jpg';

    String token = 'a correct secret token';
    Map<String, String> headers = {"Authorization": "Bearer " + token};
    return CachedNetworkImage(
      placeholder: (context, url) => CircularProgressIndicator(),
      imageUrl: url,
      httpHeaders: headers,
    );
  }
}

This is what I tried, but the image is never shown

class RemoteImage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

    String tripId = 'TXt1XIvqUDzBP6T11xTF';
    String url = 'http://localhost:8080/api/trips/$tripId/images/$tripId.jpg';

    FirebaseAuth.instance.currentUser().then((FirebaseUser user) {
      user.getIdToken().then((String token) {
        Map<String, String> headers = {"Authorization": "Bearer " + token};
        return CachedNetworkImage(
          // placeholder: (context, url) => CircularProgressIndicator(),
          imageUrl: url,
          httpHeaders: headers,
        );
      });
    });

    return CircularProgressIndicator();
  }
}

I know the problem, but I'm stuck finding a solution. I would appreciate if someone can give me a hint in which direction I need to search.

Thx