I am getting error at this point. The result works fine but it shows error for a second. I think this is because i'm using FutureBuilder inside a FutureBuilder. I need to call two methods at 'future:' so instead of that i used another FutureBuilder but it is showing error.
sendOfferButton() {
return FutureBuilder(
initialData: [],
future: getUserProfile(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
cnicCheck = snapshot.data['CNIC'];
return RaisedButton(
padding: EdgeInsets.symmetric(vertical: 10),
child: Text('Send Offer'),
textColor: Colors.white,
color: Colors.green,
onPressed: () {
if (cnicCheck == "verified") {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => SendOffer(),
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => VerifyCNIC(),
),
);
}
},
);
},
);
}
Future getUserProfile() async {
DocumentSnapshot document = await FirebaseFirestore.instance
.collection('Users')
.doc(FirebaseAuth.instance.currentUser.email)
.get();
return document;
}