我尝试将 Android 项目连接到 Firebase,但在将以下内容添加到 pubsec.yaml 时出现此错误:
firebase_auth: ^0.16.0
cloud_firestore: ^0.13.5
Run Code Online (Sandbox Code Playgroud)
当我运行 gradle 但它不起作用时
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :firebase_auth_web not found. Please update settings.gradle.
Plugin project :cloud_firestore_web not found. Please update settings.gradle.
Run Code Online (Sandbox Code Playgroud)
有什么解决办法吗
dart firebase firebase-authentication flutter google-cloud-firestore
我尝试运行该应用程序,但收到以下错误:
Compiler message:
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.6.0+2/lib/src/dialogs.dart:272:17: Error: No named parameter with the name 'onRatingChanged'.
onRatingChanged: (rating) {
^^^^^^^^^^^^^^^
../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/smooth_star_rating-1.1.0+1/lib/smooth_star_rating.dart:23:3: Context: Found this candidate, but the arguments don't match.
SmoothStarRating({
^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script '/Users/ahmed/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 896
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/ahmed/Developer/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack …Run Code Online (Sandbox Code Playgroud) 我是 Flutter 新手,我遇到一个问题,因为我想使用从 Numbers() 函数传递的值更新 Text 小部件。
问题是当我按下按钮时,文本中的值在屏幕上不会改变,但在控制台中会改变。
class _HomeState extends State<Home> {
int n = 10;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurpleAccent,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(n.toString()),
RaisedButton(
onPressed: (){
n += numbers();
print(n.toString());
},
),
],
),
),
);
}
}
int numbers (){
List<int> numbersList = List(1);
numbersList[0] = 30;
int n1 = numbersList[0];
return n1;
print(numbersList[0].toString());
}
Run Code Online (Sandbox Code Playgroud) 我正在颤振中制作注册和登录页面并面临一个问题,因为我想使用在 main.dart 文件中的类 _MyHomePage 中声明的相同变量“电子邮件”和“密码”
到 signup.dart 文件中的另一个类 SignupPage。
我已经导入了文件,但我不能在两个类中使用这些值
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
String _email = '';
String _password = '';
final formKey = new GlobalKey<FormState>();
FormType _formType = FormType.login;
bool validateAndSave() {
final form = formKey.currentState;
if (form.validate()) {
form.save();
return true;
// print('Form is Valid Email: $_email, Password: $_password');
}
return false;
}
Run Code Online (Sandbox Code Playgroud) 我尝试将用户存储在 Firestore 中的集合中作为文档,并希望使每个用户 ID 与文档 ID 相同。我尝试过,但它仍然为我提供了另一个用户 ID:
Future<void> userSetupDone() async {
CollectionReference users = FirebaseFirestore.instance.collection('Users');
final docUser = FirebaseFirestore.instance.collection('Users').doc();
FirebaseAuth auth = FirebaseAuth.instance;
String? uid = docUser.id;
// String? uid = auth.currentUser?.uid.toString();
String? email = auth.currentUser?.email.toString();
String? phone = auth.currentUser?.phoneNumber.toString();
String? displayName = auth.currentUser?.displayName.toString();
users.add({'Uid': uid, "Email": email, "Phone": phone, "Name": displayName});
return;
}
Run Code Online (Sandbox Code Playgroud)
dart firebase google-cloud-platform flutter google-cloud-firestore