I have a function that I’ve coded separately that performs fine when selected alone. It basically uploads some details to Firestore.
When I try to have it then Navigate back to the homepage on the same click, it navigates away but no file is made. SizedBox(
SizedBox(
width: 200,
height: 75,
child: ElevatedButton(
onPressed: () async {
createEvent;
Navigator.pushNamed(context, '/homePage');
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50))),
child: const Text(
'C R E A T E E V E N T'
),
),
),
2
Answers
So it turns out the solution to this was in editing the createEvent code itself to perform the action rather than asking the button to do it. I simply added the line
at the bottom of its code.
Edited : sorry it forget to add the
then part
do it as the folowing