'Flutter with AWS Amplify. How to list search result with image

I currently use the following workflow to show search list in my flutter app with AWS amplify.

  1. Call Amplify.API.query to get search result from elastic search. Each item contains a key to the photo in S3.
  2. For each item in the search result, I call S3 storage to download the photo and attach it to the item.
  3. After updating all items in the search result with photo images, return the search result to the caller

Although it works, I feel like this is not the optimal way to do it. I considered saving the S3 photo url in the elastic search itself and use network image to display it in the app so that I don't have to make a call to S3 when retrieving the search result, but I think the S3 url has an expiry date and won't work after some time (correct me if I'm wrong).

What's the correct way to support search and display result with photos?

Let me know if you need more clarification.

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source