草庐IT

future_base

全部标签

json - Dart 从 base64 转换整个 json 树

我有json,其中每个值都编码为base64。我想遍历整棵树并解码每个值。这需要是自动的。代码中不能指定json键。它需要自己下降。我该怎么做?这是我目前的情况MapparseJson(Stringresponse){vardata=json.decode(response);//HereIneedtodecodefrombase64returndata;}这是json的样子{"app_title":"RnJpU8Okaw==","app_color":"I0ZGRUUzMw==","app_tabs":[{"title":"RW4gdGl0ZWwgw6XDpMO2w4XDhMOW",

dart - 错误 : The argument type '(File) → Future<dynamic>' can't be assigned to the parameter type '(dynamic) → FutureOr<dynamic>'

我正在尝试编译示例:https://github.com/dart-lang/googleapis_examples/blob/master/drive_upload_download_console/bin/main.dart我得到以下Dart编译错误error:Theargumenttype'(File)→Future'can'tbeassignedtotheparametertype'(dynamic)→FutureOr'.(argument_type_not_assignableatlib/google_api_rest/main.dart:49)来自以下代码://Downlo

dart - Flutter - 将 future 列表传递给 SearchDelegate

我一直在关注-boringfluttershow上的Flutter搜索教程.我一直在尝试使用从future列表派生的列表来实现相同的功能,其中数据来自api(在本例中为Aqueduct服务器)。目前我的屏幕列出了API中的所有联系人,我现在想针对该联系人列表进行搜索。我假设最好的做法是将相同的列表(已经显示)传递给搜索委托(delegate)。不幸的是,我不确定如何实现这一目标。我的代码如下(请注意我已经为这个例子精简了一些代码):class_ContactsScreenStateextendsState{staticconst_usersUrl=//urlinfo;staticfin

dart - 如何将 Future<dynamic> 转换/转换为图像?

我有像这样获取图像的功能dynamicimgBinary=_repository.fetchImage(productId);我想将其添加到图像列表中ListlistImages=newList();很喜欢dynamicimgBinary=_repository.fetchImage(productId);listImages.add(imgBinary);这个怎么投? 最佳答案 好的,所以你可以尝试.then方法。因为_repository.fetchImage(productId);是future。所以你可以试试-Listlis

dart - future build 者( future :) is recursing my http requests,

我需要在页面呈现之前从三个不同的url获取数据。所以,这是我的ScopedModel中的方法,包括多个http.post方法:FuturefetchData()async{_isLoading=true;notifyListeners();awaitfetchAvailable();awaitfetchOnProgress();awaitfetchCompleted();_isLoading=false;notifyListeners();fetchData区域中的方法只是带有原始Future类型的经典http.post请求。这是我的FutureBuilder:FutureBuilde

asynchronous - 获取方法 Future<T> 的结果 flutter

我有一个方法FuturegetCurrentUser()async{FirebaseUseruser=await_firebaseAuth.currentUser();returnuser;}我希望能够通过以下方式在其他模块中调用它:if(class.getCurrentUser()!=null){//Dosomething}我似乎无法弄清楚如何获取实际值,而不是存储该值的Future对象。例如,在C++中,我可以执行future.get(),这将阻止并将值返回给我。有flutter的等价物吗?我是这门语言的新手,已经搜索了几个小时,但似乎找不到解决这个确切问题的方法。

firebase - flutter future :A build function returned null

我想从firebase检索数据到futurebuilder。我为此使用了这个函数。FuturegetAllData()async{ReseviorDataModelresModel;DatabaseReferenceref=FirebaseDatabase.instance.reference();DataSnapshotchilded=awaitref.child("Reservoir/${widget.placeName}").once();Mapvalues;values=childed.value;resModel=ReseviorDataModel.customConstrc

flutter - future 结束时移动到新屏幕的最佳方式

我有一个从api获取数据的初始屏幕。我希望在获取数据时此屏幕处于事件状态(它包含一个圆形进度小部件),但一旦获取数据,我必须推送一条新路线以转到下一个屏幕。我一直在玩futurebuilder,但这似乎不是正确的小部件,因为我不想在获取数据时构建任何东西(至少在这个屏幕上)。我只想将其作为全局状态数据保留并继续前进。在Flutter中实现这一点的最佳方法是什么?这是我现在拥有的:classSplashScreenextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnScaffold(appBar:A

firebase - Dart 错误 : Unhandled exception: E/flutter ( 5079): Invalid argument: Instance of 'Future<String>'

我正在尝试将文档添加到我的云Firestore数据库。以这种方式。FuturecurrentlyIn()async{FirebaseAuthauth=FirebaseAuth.instance;Stringfuser=awaitauth.currentUser();});returnfuser.uid;}Mapvotedown(){Mapcomdata={'user_Id':currentlyIn(),'actual_vote':0,'voteUp':false,};returncomdata;}DocumentReferencestoreReference=Firestore.ins

firebase - flutter : future 不工作,它告诉我错误?

在我下面的代码中,future不工作......编辑的代码在下面########################################################################################################################################################################################################################################################################