无法捕获异常 Firebase 实时数据库

Can't catch exception Firebase Realtime database

我试图在密码少于 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):

我正在使用带有 flutter 的实时数据库。

我做错了什么?

尝试:

 on FirebaseAuthException catch (e) {
    print(e.code);
    print(e.message);
 }