如何从放大存储中获取图像 url 并在 flutter 中显示在显示屏上?

gs9*_*ahn 5 image amazon-s3 flutter aws-amplify

我正在尝试从放大存储中获取图像 URL 并显示在用户界面上。但由于获取图像 URL 需要一些时间,显示器上不断显示图像无法可视化。我怎样才能在颤振中实现这一点?这是获取图片url的实现

Future<String> getImageUrl(String key) async {
    try {
      final result = await Amplify.Storage.getUrl(key: key);
      print('Storage successful');
      return result.url;
    } on StorageException catch (storeError) {
      print('Storage failed - $storeError');
      return '';
    }
  }
Run Code Online (Sandbox Code Playgroud)