當密碼少于 6 個字符時,我試圖拋出一條訊息,但我無法捕捉到例外。
final email = _email.text;
final password = _password.text;
try {
final userCredential = await FirebaseAuth.instance
.createUserWithEmailAndPassword(
email: email,
password: password
);
print(userCredential);
} on FirebaseAuthException catch (e) {
print(e.runtimeType);
print ('Password should be at least 6 characters long');
print(e);
}
我正在嘗試這樣做,但終端不斷向我顯示例外未處理:
W/System (18810): Ignoring header X-Firebase-Locale because its value was null.
E/flutter (18810): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [firebase_auth/weak-password] Password should be at least 6 characters
E/flutter (18810): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (18810): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
E/flutter (18810): <asynchronous suspension>
E/flutter (18810): #2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:377:43)
E/flutter (18810): <asynchronous suspension>
E/flutter (18810): #3 MethodChannelFirebaseAuth.createUserWithEmailAndPassword (package:firebase_auth_platform_interface/src/method_channel/method_channel_firebase_auth.dart:256:12)
E/flutter (18810): <asynchronous suspension>
E/flutter (18810): #4 FirebaseAuth.createUserWithEmailAndPassword (package:firebase_auth/src/firebase_auth.dart:238:7)
E/flutter (18810): <asynchronous suspension>
E/flutter (18810): #5 _RegisterViewState.build.<anonymous closure>.<anonymous closure> (package:flutter_firebase_example_7_04/main.dart:233:42)
E/flutter (18810): <asynchronous suspension>
E/flutter (18810):
我正在使用帶有顫振的實時資料庫。
我究竟做錯了什么?
uj5u.com熱心網友回復:
嘗試 :
on FirebaseAuthException catch (e) {
print(e.code);
print(e.message);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/477775.html
標籤:火力基地 扑 异步 firebase-实时数据库
上一篇:在R中生成隨機字母和空格的字串
