我对如何在流中调用s3 objects
有点困惑。
Get请求在AWS中是可计费的,因此在流中放置图像会导致对S3对象的请求过多。
是否有任何方法被遵循的扑动部件,其中它有一个图像和文本内容(如:事件)
使用流并不一定意味着你会频繁地执行API调用。你还可以使用Future
API调用并添加其响应StreamController。
下面是一个例子。
// Let Repository contain API requests
final _repository = Repository();
final _albumFetcher = StreamController<List<AlbumModel>>();
Stream<List<AlbumModel>> get allAlbums => _albumFetcher.stream;
fetchAlbum() async {
// Fetch data and add the response on your StreamController
List<AlbumModel> listAlbums = await _repository.fetchAllAlbums();
_albumFetcher.sink.add(listAlbums);
}
流只会在fechAlbum()被调用时更新。流不会连续发送API请求来获取数据。
这是我创建的一个示例,您可以试用一下。
有几种方法可以做到这一点。一种方法是使用Signature V4和POST对请求进行签名