I am trying to display a file on tap of button. But before the file loads, I want the circular progress indicator to start and after the file loads, I want it to stop. I have implemented the following code but the problem is the indicator keeps on loading even after file loads.
InkWell(
onTap: () async {
player.stop();
Center(
child: CircularProgressIndicator(),
);
final files = await loadPdfFromNetwork(file.url);
openPdf(context, files, file.url,file.name.split('.').first);
}
2
Answers
You could use Navigator.of(context).pop .
InkWell(
Navigator.of(context).pop
You can use stream builder to avoid any error in future as well.