Firebase Authentication Sign-Up Not Working in Flutter: ‘Given String is empty or null’ Error”

I am trying to use the flutter firebase Signup method in my application but it is not working as expected, The value of Textformfields is null according to the app while there is still text written
i am also trying to save data to firestore by attaching a model
here is my model code

class UserModel {
  String name;
  String userName;
  String email;
  String password;
  UserModel(
      {required this.name,
      required this.userName,
      required this.email,
      required this.password});

  Map<String, dynamic> toMap() {
    return {
      'FullName': name,
      'userName': userName,
      'userEmail': email,
      'Password': password,
    };
  }

  factory UserModel.fromMap(Map<String, dynamic> map) {
    return UserModel(
        name: map['name'],
        userName: map['userName'],
        email: map['email'],
        password: map['password']);
  }
}

here is my firebase signup method, everything seems fine according to me

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:zoom_clone/models/user_mode.dart';
import 'package:zoom_clone/utils/snackbar.dart';

class FirebaseSignUpService extends ChangeNotifier {
  final FirebaseAuth _auth = FirebaseAuth.instance;
  final FirebaseFirestore _firestore = FirebaseFirestore.instance;

  Future<void> signUpUser({
    required String name,
    required String userName,
    required String email,
    required String password,
  }) async {
    if (name.isEmpty || userName.isEmpty || email.isEmpty || password.isEmpty) {
      Snackbar(snackBartext: "All fields are required", isError: true);
      return;
    }
    try {
      UserCredential userCredential =
          await _auth.createUserWithEmailAndPassword(
        email: email,
        password: password,
      );

      UserModel userModel = UserModel(
        name: name,
        userName: userName,
        email: email,
        password: password,
      );

      await _firestore
          .collection('users')
          .doc(userCredential.user?.uid)
          .set(userModel.toMap());

      notifyListeners();
      Snackbar(snackBartext: 'Account Created Successfully', isError: false);
    } on FirebaseException catch (e) {
      Snackbar(snackBartext: e.message.toString(), isError: true);
    }
  }
}

I am using form and TextForm validator to check if the values are not empty or null
below is the code to my UI

import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:zoom_clone/services/signup_services.dart';
import 'package:zoom_clone/utils/primarybtn.dart';
import 'package:zoom_clone/views/components/txtformfield.dart';

class Signupui extends StatefulWidget {
  const Signupui({super.key});

  @override
  State<Signupui> createState() => _SignupuiState();
}

class _SignupuiState extends State<Signupui> {
  TextEditingController nameController = TextEditingController();
  TextEditingController usernameController = TextEditingController();
  TextEditingController emailController = TextEditingController();
  TextEditingController passwordController = TextEditingController();
  TextEditingController confirmController = TextEditingController();
  FirebaseSignUpService signUpService = FirebaseSignUpService();
  final formKey = GlobalKey<FormState>();

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    return Scaffold(
      appBar: AppBar(
        automaticallyImplyLeading: true,
        backgroundColor: Colors.transparent,
        elevation: 0,
        scrolledUnderElevation: 0,
      ),
      body: Padding(
        padding: EdgeInsets.symmetric(
          horizontal: size.width * 0.07,
        ),
        child: Center(
          child: SingleChildScrollView(
            padding: EdgeInsets.symmetric(vertical: size.height * 0.15),
            keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
            child: Form(
              key: formKey,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Align(
                    alignment: Alignment.centerLeft,
                    child: Text(
                      'Create An Account',
                      style: TextStyle(fontSize: 22),
                    ),
                  ),
                  SizedBox(
                    height: size.height * 0.02,
                  ),
                  Txtformfield(
                    validator: (value) {
                      if (value == null || value.isEmpty) {
                        return 'Enter Your Name';
                      }
                      return null;
                    },
                    labelText: 'Enter Your Name',
                    isPassword: false,
                    icon: FontAwesomeIcons.user,
                    controller: nameController,
                  ),
                  SizedBox(
                    height: size.height * 0.02,
                  ),
                  Txtformfield(
                    validator: (value) {
                      if (value == null || value.isEmpty) {
                        return 'Enter Your User Name';
                      }
                      return null;
                    },
                    labelText: 'Username',
                    isPassword: false,
                    icon: FontAwesomeIcons.a,
                    controller: usernameController,
                  ),
                  SizedBox(
                    height: size.height * 0.02,
                  ),
                  Txtformfield(
                    validator: (value) {
                      if (value == null || value.isEmpty) {
                        return 'Email is Required';
                      }
                      return null;
                    },
                    labelText: 'Enter Your Email',
                    isPassword: false,
                    icon: FontAwesomeIcons.at,
                    controller: emailController,
                  ),
                  SizedBox(
                    height: size.height * 0.02,
                  ),
                  Txtformfield(
                    validator: (value) {
                      if (value == null || value.isEmpty) {
                        return 'Password cannot be empty';
                      }
                      return null;
                    },
                    labelText: 'Password',
                    isPassword: true,
                    icon: FontAwesomeIcons.key,
                    controller: passwordController,
                  ),
                  SizedBox(
                    height: size.height * 0.02,
                  ),
                  Txtformfield(
                    validator: (value) {
                      if (value == null || value.isEmpty) {
                        return 'Confirm Your Password';
                      }
                      if (value != passwordController.text) {
                        return 'Passwords do not match';
                      }
                      return null;
                    },
                    labelText: 'Confirm Password',
                    isPassword: true,
                    icon: FontAwesomeIcons.key,
                    controller: confirmController,
                  ),
                  SizedBox(
                    height: size.height * 0.03,
                  ),
                  Primarybtn(
                    btnText: 'SIGN UP!',
                    onTap: () {
                      if (formKey.currentState?.validate() ?? false) {
                        signUpService.signUpUser(
                          name: nameController.text,
                          userName: usernameController.text,
                          email: emailController.text,
                          password: passwordController.text,
                        );
                      } else {
                        print('Please enter all values');
                      }
                    },
                    width: size.width * 0.6,
                    height: size.height * 0.07,
                    radius: 20,
                    size: size.width * 0.055,
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Instead of the function call in the if block the print statement gets printed in the console

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật