'i have a code made for firebase realtime database and i want to write same code for cloud firestore

i succesfully added user's phone number when user register with phone auth firebase now i want to fetch that user from firestore when i press login button and login with that user

          Container(
          margin: EdgeInsets.all(10),
          width: double.infinity,
          child: MaterialButton(
            color: Colors.blue,
            onPressed: () {
              dbRef.reference().orderByChild("mobile").
              equalTo(_controller.text).get().then((value)  {

                if(value.value==null)
                  {

                    _scaffoldkey.currentState!
                        .showSnackBar(SnackBar(content: Text('No User Found')));
                    return;
                  }

                print("User Password ${value.value}");
                Map data= value.value;
                data.forEach((key, value) {
                  if(_passwordcontroller.text==value['password']&&(_controller.text==value['mobile']))
                    {
                      print("User Exist");
                      Navigator.pushAndRemoveUntil(
                          context,
                          MaterialPageRoute(builder: (context) => Home(key,value['name'])),
                              (route) => false);
                    }else
                      {
                        print("User Not found Exist");
                      }

                });
              });

              
            },
            child: Text(
              'Login',
              style: TextStyle(color: Colors.white),
            ),
          ),
        ),


Sources

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

Source: Stack Overflow

Solution Source