Untitled
unknown
plain_text
2 years ago
972 B
19
Indexable
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;
}
Editor is loading...
Leave a Comment