草庐IT

function-centered

全部标签

function - 如何将函数传递给其他类并将函数的响应返回给 flutter 中的主类

我有一个在主类中调用它的类,但我想将一个函数传递给子类并将函数运行到子类并将函数的响应返回给主类在flutterdart中如何做。 最佳答案 做classsubclassNamefinalfunctionNameOfFunction;subclassName(this.NameOfFunction);在主类中subclassName(thefunctionyouwanttopass);主要class_MyAppStateextendsState{var_questionIndex=0;void_answerQuestion(){se

function - 使用功能在 flutter 中添加多个图像?

我没有遇到任何问题,但我有一个问题,因为我必须在我的应用程序中添加多张图片。假设将来这些图像的数量会变得很大,所以我只想知道我们如何在flutter中使用函数。这就是我现在添加图像的方式:Container(color:Colors.redAccent,height:2),SizedBox(height:8),Row(crossAxisAlignment:CrossAxisAlignment.start,children:[Expanded(child:Image.asset('assets/cat.jpg',width:110.0,height:100.0,fit:BoxFit.fi

function - 在它之外调用小部件自己的功能

我有一个有状态的小部件,它可能有两种情况,第一种是带有第一个文本的容器,例如“注册”,第二种是带有不同文本的不同颜色的容器,因为例如“确认”。问题是这两种情况之间的转换是使用动画完成的,而不是即时逻辑,例如:color:isSituation1?Colors.blue:Colors.red.其实是这样的:color:Color.lerp(Colors.blue,Colors.red,_animation1.value)我有一个函数,当用户点击转发动画Controller的容器时运行,如下所示:_controller1.forward()这是一个名为Button1的小部件所以在我的主页有

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

firebase - 什么是在 Flutter 中使用 Firebase Cloud Functions 的方法。

我一直在搜索如何使用flutter应用程序实现firebase功能。似乎还没有可用的SDK。我还尝试将gradle依赖项implementation'com.google.firebase:firebase-functions:15.0.0'添加到我的app/build.gradle但这会导致构建错误。有人做过有效的实现吗?我找不到任何关于如何处理凭据和数据传输以构建我自己的firebase函数调用的文档。我已经大致概述了我认为这是如何工作的,但可能与基础相去甚远。FutureupdateProfile(Stringuid,AccountMasterViewModelavm)async

firebase - flutter/火力基地 : How can i access the current user without using '.then(...)' function

我试图避免在我需要访问当前用户UID的所有代码中使用.then((u){returnu.uid})函数,而只是通过调用getCurrentUser().uid以获得更快的访问速度。但是,它给了我一个错误Thegetter'uid'wascalledonnull.但它不是null,因为它确实在控制台中打印,但只有在显示它为null并且最后出现一些错误之后原因。我不太了解Future/Async/Await逻辑,因此非常感谢任何帮助!classUsersAPI{finalDatabaseReferenceusersRef=FirebaseDatabase.instance.referenc

android - 方法 'listen' 没有为类 'Function' 定义?

大家好,我正在尝试构建一个flutter来显示纬度和经度,但我仍然在代码中遇到错误:voidinitState(){super.initState();//Defaultvariableset0currentLocation['latitude']=0.0;currentLocation['longtitude']=0.0;initPlatformState();locationSubscription=location.onLocationChanged.listen((Mapresult){setState((){currentLocation=result;});});}

google-cloud-firestore - 如何使用带有 Flutter 的 Cloud Function 从新图像获取 URL?

如何使用图像名称从fire-storage中的新图像获取URL?我正在使用firebase_storage使用Flutter上传图片插件flutter中的代码:StorageReferenceref=FirebaseStorage.instance.ref().child("$stamp.jpg");StorageUploadTaskuploadTask=ref.putFile(imageFile);UridownloadUrl=(awaituploadTask.future).downloadUrl;downloadableUrl=downloadUrl.toString();但是图

dart - 命名参数 'child' 未定义。在 Center() 构造函数中

我今天运行了flutterupgrade,现在我收到一条错误消息:[dart]Thenamedparameter'child'isn'tdefined.项目是新建的,默认代码没有动,但是还是一样的错误: 最佳答案 通过运行清理项目缓存fluttercleancache然后使缓存无效/重新启动AndroidStudio或VSCode。 关于dart-命名参数'child'未定义。在Center()构造函数中,我们在StackOverflow上找到一个类似的问题:

python的opencv错误The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon

1、出现问题:cv2.error:OpenCV(4.5.4-dev)D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1274:error:(-2:Unspecifiederror)Thefunctionisnotimplemented.RebuildthelibrarywithWindows,GTK+2.xorCocoasupport.IfyouareonUbuntuorDebian,installlibgtk2.0-devandpkg-config,thenre-runcmakeorconfigur