我正在获取从我的CloudFirestore数据库存储的视频URL,并在listView.builder()中显示网络视频。当我设置autiInitialize=true或者尝试以任何其他方式初始化视频我得到错误Exceptionhasoccurred.Badstate:Futurealreadycompleted和I/flutter(6187):══╡EXCEPTIONCAUGHTBYFOUNDATIONLIBRARY╞════════════════════════════════════════════════════════I/flutter(6187):Thefollowin
我有一个名为“retrieveDB”的函数,它使用shared_preferences.dart插件检索数据,我将使用这些数据来决定是否要从Firestore检索什么集合/文档名称。我已经在类的顶部初始化了usersDB和notifDoc=""。FutureretrieveDB()async{SharedPreferencesprefs=awaitSharedPreferences.getInstance();Stringdb=prefs.getString('db');if(db=="MISS"){usersDB="users_miss";notifDoc="notifTokenMI
我收到错误消息:UnhandledException:type'_InternalLinkedHashMap'isnotasubtypeoftype'Future`_LocationScreenState.build.(package:clima/screens/location_screen.dart:71:32)被精确定位的线在里面:FlatButton(onPressed:()async{varweatherData=awaitweather.getLocationWeather();updateUI(weatherData);//weather.getLocationWeath
我试图从我的firestore中获取确定集合中的所有文档,之后,我想将它们设置在文档列表中,列表的每个位置代表一个文档。但是,当我编写代码时,我收到了这个错误:类型“Future”不是类型转换中类型“List”的子类型import'package:cloud_firestore/cloud_firestore.dart';classRestaurant{Stringkeyword;Stringstate;Stringaddress;Stringcity;intevaluation;Stringimage;Stringphone;doublerating;Stringschedule;S
我想使用FutureBuilder检查url是否为png图像,然后构建一个或两个图像(在列表中)。但是不知何故,当我打印它时,Future总是返回null...结果是应用程序始终使用两个CachedNetworkImages构建ListView,这不是我想要的。如果URL是图像,它应该只使用该url构建一个CachedNetworkImage,如果不是,它应该更改url并构建一个包含2个图像的ListView。child:newFutureBuilder(future:_getImages(widget.imgUrl),builder:(BuildContextcontext,Asyn
我有这个功能,它使用audioplayerplugin在Flutter内部播放声音.play(intsoundFrequency)async{finalresult=awaitaudioPlayer.play("urltosound.wav");}它工作正常。但现在我希望能够连续播放多个声音。好像我把future搞砸了。我尝试了这种方法,它非常肮脏和丑陋,但我只是想弄清楚:playRandomSequence()async{finalresult=audioPlayer.play("urltosound.wav").then(play2(pickRandomSoundFrequency
我刚刚更新了Flutter,并成功地从git下载了我的原始项目。现在我遇到了一个奇怪的Future错误。我在github上看到在线提到它,但没有关于如何修复的明确答案。该项目甚至不加载。它从我的main.dart文件中读取Future语句并返回这个...[VERBOSE-2:dart_error.cc(16)]Unhandledexception:type'Futuredynamic'isnotasubtypeoftype'FutureString'whereFutureisfromdart:asyncFutureisfromdart:asyncStringisfromdart:cor
我正在使用返回路径字符串的image_picker,它是一个future,所以当我得到future时,我希望能够检查最后3个字符是图像还是电影的文件类型。当我尝试子字符串时,我尝试的一切似乎都无法将字符串设置为Future或int相同。我显示的代码是用于返回所选文件的futurebuilder的容器。如果您想查看其他内容,请告诉我。newContainer(alignment:Alignment.bottomLeft,padding:newEdgeInsets.only(left:10.0),child:newFutureBuilder(future:_imageFile,builde
我正在尝试在我的flutter应用程序中读取和写入文件......像这样:Futureget_localPathasync{print('hi');finaldirectory=awaitgetApplicationDocumentsDirectory();returndirectory.path;}Futureget_localFileasync{finalpath=await_localPath;Filef=File('$path/mypollshash.txt');if(f.existsSync()){print('exists');Stringcontents=awaitf.r
在如下场景中,如何传递一个变量ListitemList通过引用?Future.wait([futDocs]).then((dataRet){dataRet.forEach((doco){vardocList=doco.documents;docList.forEach((doc){vardocTitle=doc['title'];print("datais$docTitle");itemList.add(docTitle);itemListitemList.add(docTitle)时不会改变在上面的Future.wait()中执行。我相信原因是因为itemList不通过引用传递。如果