gpt4 book ai didi

flutter - 将Future转换为Stream:Future.asStream()vs Stream.fromFeature(…)

转载 作者:行者123 更新时间:2023-12-03 03:01:11 35 4
gpt4 key购买 nike

使用 Future.asStream Stream.fromFeature 获取流之间有什么区别吗?

在一个之上使用另一个有什么利弊吗?

最佳答案

其实是完全一样的。我刚刚检查了将来的实现,并且Future.asStream使用Stream.fromFeature:

Stream<T> asStream() => new Stream<T>.fromFuture(this);

您可以在此处 https://github.com/dart-lang/sdk/blob/master/sdk/lib/async/future_impl.dart进行检查。

希望能帮助到你!

关于flutter - 将Future转换为Stream:Future.asStream()vs Stream.fromFeature(…),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59394985/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com