'Can't use email with a password to create a user in the Firebase console

My program runs successfully without bug.

After the virtual machine enters the email and password

first: click the Register button without jumping to the next page

second: return to the User tab of the authentication page, , which shows in the Firebase console that this project does not currently have users.

I don't know what went wrong

this is my registrationScreen code

import 'package:flutter/material.dart';
import 'chat_screen.dart';
import 'package:flutter_application_3_vs/constants.dart';
import 'package:firebase_auth/firebase_auth.dart';

class RegistrationScreen extends StatefulWidget {
  static const String id = "registration_screen";
  @override
  _RegistrationScreenState createState() => _RegistrationScreenState();
}

class _RegistrationScreenState extends State<RegistrationScreen> {
  late String email;
  late String password;
  final FirebaseAuth _auth = FirebaseAuth.instance;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color.fromARGB(255, 65, 110, 132),
      body: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 24.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            Hero(
              tag: "logo",
              child: SizedBox(
                height: 200,
                child: Image.asset('images/logo.png'),
              ),
            ),
            const SizedBox(
              height: 48.0,
            ),
            TextField(
              keyboardType: TextInputType.emailAddress,
              textAlign: TextAlign.center,
              onChanged: (value) {
                email = value;
              },
              decoration: kTextFeidDecoration.copyWith(hintText: "input  email"),
            ),
            const SizedBox(
              height: 8.0,
            ),
            TextField(
              obscureText: true,
              textAlign: TextAlign.center,
              onChanged: (value) {
                password = value;
              },
              decoration: kTextFeidDecoration.copyWith(hintText: "input password"),
            ),
            const SizedBox(
              height: 24.0,
            ),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 16.0),
              child: Material(
                color: Colors.blueAccent,
                borderRadius: const BorderRadius.all(Radius.circular(30.0)),
                elevation: 5.0,
                child: MaterialButton(
                  onPressed: () async {
                    try {
                      final newUser =
                          (await _auth.createUserWithEmailAndPassword(
                                  email: email, password: password))
                              .user;
                      if (newUser != null) {
                        Navigator.pushNamed(context, ChatScreen.id);
                        
                      }
                    } catch (e) {
                      print(e);
                    }
                  },

when I run is the output of my vscode debugging console

D/InputMethodManager( 2095): showSoftInput() view=io.flutter.embedding.android.FlutterView{e5f1730 VFE...... .F...... 0,0-1080,2208 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController( 2095): show(ime(), fromIme=true)
D/InputMethodManager( 2095): showSoftInput() view=io.flutter.embedding.android.FlutterView{e5f1730 VFE...... .F...... 0,0-1080,2208 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController( 2095): show(ime(), fromIme=true)
D/InputMethodManager( 2095): showSoftInput() view=io.flutter.embedding.android.FlutterView{e5f1730 VFE...... .F...... 0,0-1080,2208 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController( 2095): show(ime(), fromIme=true)
D/EGL_emulation( 2095): app_time_stats: avg=314.21ms min=56.71ms max=496.93ms count=4
D/InputMethodManager( 2095): showSoftInput() view=io.flutter.embedding.android.FlutterView{e5f1730 VFE...... .F...... 0,0-1080,2208 #1 aid=1073741824} flags=0 reason=SHOW_SOFT_INPUT
D/InsetsController( 2095): show(ime(), fromIme=true)
D/EGL_emulation( 2095): app_time_stats: avg=370.18ms min=118.62ms max=500.19ms count=3
W/System  ( 2095): Ignoring header X-Firebase-Locale because its value was null.
D/EGL_emulation( 2095): app_time_stats: avg=371.83ms min=119.00ms max=500.65ms count=3
2
W/System  ( 2095): Ignoring header X-Firebase-Locale because its value was null.
D/EGL_emulation( 2095): app_time_stats: avg=29.69ms min=10.27ms max=330.47ms count=34

This is the firebase dependency in my pubspec.yaml file

 firebase_core: ^1.16.0
 firebase_auth: ^3.3.17
 cloud_firestore: ^3.1.13``

this is my mian.dart

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'screens/registration_screen.dart';
import 'screens/chat_screen.dart';
import 'screens/login_screen.dart';
import "screens/welcome.dart";

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(const FlashChat());
}

class FlashChat extends StatelessWidget {
  const FlashChat({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark().copyWith(
        textTheme: const TextTheme(
          bodyText1: TextStyle(color: Color.fromRGBO(237, 225, 225, 0.533)),
        ),
      ),
      initialRoute: WelcomeScreen.id,
      routes: {
        WelcomeScreen.id: (context) => const WelcomeScreen(),
        LoginScreen.id: (context) => LoginScreen(),
        RegistrationScreen.id: (context) => RegistrationScreen(),
        ChatScreen.id: (context) => const ChatScreen(),
      },


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source