简体   繁体   English

多个 REST API 与 dart

[英]Multiple REST API with dart

I have three JSON APIs are loading in one page but when run its take more time to load the contents, what is the best way to make it more speed and efficient?我有一页加载了三个JSON API,但是当运行它需要更多时间来加载内容时,让它更快更高效的最佳方法是什么?

You could try to use Streams to do this.您可以尝试使用Streams来执行此操作。

I would suggest that you take a look at this article that explains alot on how combine multiple streams.我建议你看看这篇文章,它解释了很多关于如何组合多个流的内容。

Doing this, you could have a repository class fetching data from your apis.这样做,您可以有一个repository class 从您的 api 获取数据。 Each of this would return you a Future and you could use the method then() to push to a stream controller.每一个都将返回一个Future ,您可以使用then()方法推送到 stream controller。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM