Issue
I used the bottom sheet and I’m using navigator.pop on the button inside the bottom sheet but want to refresh the first screen when calling popup…
code
showModalBottomSheet(
context: context,
builder: (BuildContext bc) {
return Container(
child: Wrap(
children: <Widget>[
ListTile(
leading: Icon(Icons.delete),
title: Text('delete'),
onTap: () async {
try {
final file = await File(path);
print(path);
await file.delete();
print(file);
} catch (e) {
print(e.toString());
}
Navigator.pop(context);
setState(() {
print('delete');
});
Solution
This perfectly work’s for me and hoping that also work’s for you.`
Note:- If you note get data then call that method many times.
If You try to get data from any method then call that method after `
Navigator.pop(context)
method name();
Answered By – Umesh Rajput
Answer Checked By – Robin (FlutterFixes Admin)