jjzjj

Completer

全部标签

image - 我将什么传递给 Flutter Completer 对象?

上一个关于堆栈溢出的问题讨论了获取某人发布答案的图像大小Future_getImage(){Completercompleter=newCompleter();newNetworkImage('/image/lkd0a.png').resolve(newImageConfiguration()).addListener((ImageInfoinfo,bool_)=>completer.complete(info.image));returncompleter.future;}不幸的是,由于complete.complete(info.image)在AndroidStudio中出现错误,

image - 我将什么传递给 Flutter Completer 对象?

上一个关于堆栈溢出的问题讨论了获取某人发布答案的图像大小Future_getImage(){Completercompleter=newCompleter();newNetworkImage('/image/lkd0a.png').resolve(newImageConfiguration()).addListener((ImageInfoinfo,bool_)=>completer.complete(info.image));returncompleter.future;}不幸的是,由于complete.complete(info.image)在AndroidStudio中出现错误,

firebase-realtime-database - Flutter firebase 数据库迭代项目

我想知道如何从Flutter上的路径获取对象列表,这是我获取一个对象并正常工作的方法:staticFuturegetYear(StringyearKey)async{Completercompleter=newCompleter();FirebaseDatabase.instance.reference().child("year").child(yearKey).once().then((DataSnapshotsnapshot){varyear=newYear.fromJson(snapshot.key,snapshot.value);completer.complete(year

firebase-realtime-database - Flutter firebase 数据库迭代项目

我想知道如何从Flutter上的路径获取对象列表,这是我获取一个对象并正常工作的方法:staticFuturegetYear(StringyearKey)async{Completercompleter=newCompleter();FirebaseDatabase.instance.reference().child("year").child(yearKey).once().then((DataSnapshotsnapshot){varyear=newYear.fromJson(snapshot.key,snapshot.value);completer.complete(year

Flutter Future 与 Completer

Future和Completer有什么区别?我不是在寻找任何一个的文档部分,相反,我希望看到一个显示两者之间真正区别的示例。 最佳答案 Completer是一个用于创建Future的辅助类,而Future是一个Type。所有异步函数都返回Future,但使用Completer也可以创建返回Future的同步函数。您也可以将同步函数与then等链接起来。Completer对象是单向过程,它不可重新启动。它完成工作并停止。FuturemyMethod(){finalcompleter=Completer();completer.comp

flutter - Flutter中Completer和Isolates的解释和区别

我需要在我的应用程序上返回一个Future,因为我认为我的功能需要花费太多时间才能完成。所以我得到了两个可能的答案:使用Completer或Isolate.是什么让我选择其中之一?我可以将Completer放在任何我想要的地方并相信它会正常工作吗?这是如何运作的?比如..Flutter必须以60fps的速度在屏幕上绘制,对吗?那么,它会在Canvas上绘制之后和下一次绘制之前计算这些东西吗?我很好奇,因为Flutter不是多线程的(但似乎isolates可以做到这一点)。所以我很困惑,不知道如何编写可信赖的代码。此外,是否有不使用Completer的理由?比如,我认为我的代码花费了太多