Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
972 B
5
Indexable
Never
Future<DocumentSnapshot> fetchData() async {
    String? uid = FirebaseAuth.instance.currentUser?.uid;

    return await FirebaseFirestore.instance.collection('userData').doc(uid).get();
  }
 body: FutureBuilder<DocumentSnapshot>(
        future: fetchData(),
        builder: (context, snapshot) {
          if (snapshot.connectionState == ConnectionState.done) {
            if (snapshot.hasData) {
              final data = snapshot.data!.data() as Map<String, dynamic>;

              user.name = data['name'].toString();
              user.email = data['email'].toString();
              user.location = data['location'].toString();
              user.phone = data['phone'].toString();
              user.image=data['image'].toString();
              user.password=data['password'].toString();
              user.userID=data['userID'].toString();
              if (user.image!="null")
              {
                image=user.image;
              }

              
Leave a Comment