我正在尝试使用几个类来使用函数。在第一个中,我有以下内容:import'package:flutter/material.dart';import'auth.dart';import'state_rut.dart';classSelectProfileextendsStatelessWidget{SelectProfile({this.auth,this.onSignedIn,this.name,this.lastname,this.rut,this.birthdate,this.gender,this.region,this.comune,this.city,this.street,
我正在尝试使用几个类来使用函数。在第一个中,我有以下内容:import'package:flutter/material.dart';import'auth.dart';import'state_rut.dart';classSelectProfileextendsStatelessWidget{SelectProfile({this.auth,this.onSignedIn,this.name,this.lastname,this.rut,this.birthdate,this.gender,this.region,this.comune,this.city,this.street,
FuturegetUserDoc()async{finalFirebaseAuth_auth=FirebaseAuth.instance;finalFirestore_firestore=Firestore.instance;FirebaseUseruser=await_auth.currentUser();DocumentReferenceref=_firestore.collection('users').document(user.uid);returnref;}我无法在文档中添加数据。这是我在firestore中输入数据的代码。请帮忙,我是flutter的新手returnref
FuturegetUserDoc()async{finalFirebaseAuth_auth=FirebaseAuth.instance;finalFirestore_firestore=Firestore.instance;FirebaseUseruser=await_auth.currentUser();DocumentReferenceref=_firestore.collection('users').document(user.uid);returnref;}我无法在文档中添加数据。这是我在firestore中输入数据的代码。请帮忙,我是flutter的新手returnref
我已经从firebase存储中获取图像。文档快照在类里面传递,其中正在构建流意味着第一个类,图像显示在第二堂课,但我必须在下一个类即第三堂课的Hero小部件中显示图像。因此,在第三类中,错误是:到目前为止我的代码是:从二等舱到三等舱Container(padding:EdgeInsets.all(10.0),child:Hero(tag:'1',child:GestureDetector(onTap:(){//navigateToImage(widget.ds.data['GraphImg']);Navigator.push(context,MaterialPageRoute(buil
我已经从firebase存储中获取图像。文档快照在类里面传递,其中正在构建流意味着第一个类,图像显示在第二堂课,但我必须在下一个类即第三堂课的Hero小部件中显示图像。因此,在第三类中,错误是:到目前为止我的代码是:从二等舱到三等舱Container(padding:EdgeInsets.all(10.0),child:Hero(tag:'1',child:GestureDetector(onTap:(){//navigateToImage(widget.ds.data['GraphImg']);Navigator.push(context,MaterialPageRoute(buil
如果我有一个MaterialColor(例如Colors.red)并想将它保存在Firestore(或任何数据库)中,然后当我重新启动应用程序时,检索该颜色并将其转换为MaterialColor,最好的方法是什么去做?我最初想到的只是将颜色作为字符串存储在数据库中,例如“蓝色”、“红色”等,然后使用switch语句再次将它们转换为MaterialColors。似乎有更好的出路。有什么建议吗? 最佳答案 将颜色存储为1,2,3,4…(越小越好,以便快速检索)。然后在一个全局类中,有一个基于整数返回颜色的get函数。
如果我有一个MaterialColor(例如Colors.red)并想将它保存在Firestore(或任何数据库)中,然后当我重新启动应用程序时,检索该颜色并将其转换为MaterialColor,最好的方法是什么去做?我最初想到的只是将颜色作为字符串存储在数据库中,例如“蓝色”、“红色”等,然后使用switch语句再次将它们转换为MaterialColors。似乎有更好的出路。有什么建议吗? 最佳答案 将颜色存储为1,2,3,4…(越小越好,以便快速检索)。然后在一个全局类中,有一个基于整数返回颜色的get函数。
我有一个带有questions的CloudFirebase数据库收藏。每个question有map列表options.我正在使用Flutter并为question设置了以下类和option:classQuestion{finalStringtext;finalListoptions;//IhavetriedchangingthistoListbutitdoesn'thelpfinalStringreference;Question(this.text,this.options,this.reference);Question.fromMap(Mapmap,{this.reference
我有一个带有questions的CloudFirebase数据库收藏。每个question有map列表options.我正在使用Flutter并为question设置了以下类和option:classQuestion{finalStringtext;finalListoptions;//IhavetriedchangingthistoListbutitdoesn'thelpfinalStringreference;Question(this.text,this.options,this.reference);Question.fromMap(Mapmap,{this.reference