Here is the button in question:
ElevatedButton(
onPressed: () {
FutureBuilder<String>(
future: analyzeFile(),
builder: (context, AsyncSnapshot<String> snapshot) {
if (snapshot.hasData) {
log(snapshot.data!);
return Center(child: sendToEdit(context, snapshot.data!));
} else {
return CircularProgressIndicator();
}
},
);
},
child: Text('Upload File'),
),
Based on what I’ve read, it feels like this should work – The button has a Futurebuilder, it’s set to wait for analyze file to finish when the button is pressed, and when analyze file is finished – it goes to another page.
But when I run this, I press the “Upload File” button and it just sits there on the page and everything runs in the background. And then nothing happens to the page. It never shows the progress circle, nor does it navigate, even though the analyzeFile() method completes and returns a string, so snapshot should have data. But it never even gets to the log(…) line.