I have a showModalBottomSheet
like the below, which I understand to inherit from BottomSheet
(right?)
showModalBottomSheet
I personally think the accepted answer is not as sleek as it can be. A wiser idea is to do it native Dart way without any extra complexity:
() async {
final result = await showModalBottomSheet(context: context, builder: (_) =>
);
}
It also works with Navigator.of(context).pushNamed()
. result
variable value in my case is defined by the value you pass back on Navigator.of(context).pop({value})
. You can return any kind of object and then make a simple if statement to make sure data is the one you want:
if(result != null && result == true) { ... }