try{finalcredential=awaitFirebaseAuth.instance.createUserWithEmailAndPassword(email:emailAddress,password:password,);}onFirebaseAuthExceptioncatch(e){if(e.code=='weak-password'){print('The password provided is too weak.');}elseif(e.code=='email-already-in-use'){print('The account already exists for that email.');}}catch(e){print(e);}
try{finalcredential=awaitFirebaseAuth.instance.signInWithEmailAndPassword(email:emailAddress,password:password);}onFirebaseAuthExceptioncatch(e){if(e.code=='user-not-found'){print('No user found for that email.');}elseif(e.code=='wrong-password'){print('Wrong password provided for that user.');}}
[null,null,["最后更新时间 (UTC):2025-08-04。"],[],[],null,["\u003cbr /\u003e\n\nYou can use Firebase Authentication to let your users authenticate with\nFirebase using email addresses and passwords.\n\nBefore you begin\n\n1. If you haven't already, follow the steps in the [Get started](/docs/auth/flutter/start) guide.\n\n2. Enable Email/Password sign-in:\n\n - In the Firebase console's **Authentication** section, open the [Sign in method](https://console.firebase.google.com/project/_/authentication/providers) page.\n - From the **Sign in method** page, enable the **Email/password sign-in** method and click **Save**.\n\nCreate a password-based account\n\nTo create a new user account with a password, call the `createUserWithEmailAndPassword()`\nmethod: \n\n try {\n final credential = await FirebaseAuth.instance.createUserWithEmailAndPassword(\n email: emailAddress,\n password: password,\n );\n } on FirebaseAuthException catch (e) {\n if (e.code == 'weak-password') {\n print('The password provided is too weak.');\n } else if (e.code == 'email-already-in-use') {\n print('The account already exists for that email.');\n }\n } catch (e) {\n print(e);\n }\n\nTypically, you would do this from your app's sign-up screen. When a new user\nsigns up using your app's sign-up form, complete any new account validation\nsteps that your app requires, such as verifying that the new account's password\nwas correctly typed and meets your complexity requirements.\n\nIf the new account was created successfully, the user is also signed in. If you\nare listening to changes in [authentication state](/docs/auth/flutter/start#auth-state), a new\nevent will be sent to your listeners.\n\nAs a follow-up to creating a new account, you can\n[Verify the user's email address](/docs/auth/flutter/manage-users#verify-email).\n| **Note:** To protect your project from abuse, Firebase limits the number of new email/password and anonymous sign-ups that your application can have from the same IP address in a short period of time. You can request and schedule temporary changes to this quota from the [Firebase console](https://console.firebase.google.com/project/_/authentication/providers).\n\nSign in a user with an email address and password\n\nThe steps for signing in a user with a password are similar to the steps for\ncreating a new account. From your your app's sign-in screen, call\n`signInWithEmailAndPassword()`: \n\n try {\n final credential = await FirebaseAuth.instance.signInWithEmailAndPassword(\n email: emailAddress,\n password: password\n );\n } on FirebaseAuthException catch (e) {\n if (e.code == 'user-not-found') {\n print('No user found for that email.');\n } else if (e.code == 'wrong-password') {\n print('Wrong password provided for that user.');\n }\n }\n\n| **Caution:** When a user uninstalls your app on iOS or macOS, the user's authentication state can persist between app re-installs, as the Firebase iOS SDK persists authentication state to the system keychain. See issue [#4661](https://github.com/firebase/flutterfire/issues/4661) for more information.\n\nNext steps\n\nAfter a user creates a new account, this account is stored as part of your\nFirebase project, and can be used to identify a user across every app in your\nproject, regardless of what sign-in method the user used.\n\nIn your apps, you can get the user's basic profile information from the\n`User` object. See [Manage Users](/docs/auth/flutter/manage-users).\n\nIn your Firebase Realtime Database and Cloud Storage Security Rules, you can\nget the signed-in user's unique user ID from the `auth` variable, and use it to\ncontrol what data a user can access.\n\nYou can allow users to sign in to your app using multiple authentication\nproviders by [linking auth provider credentials](/docs/auth/flutter/account-linking)) to an\nexisting user account.\n\nTo sign out a user, call `signOut()`: \n\n await FirebaseAuth.instance.signOut();"]]