Flutter onClosing callback for showModalBottomSheet

You can also achieve it by use of whenComplete function of showModalBottomSheet.

Let’s see below code

showModalBottomSheet<void>(
        context: context,
        builder: (BuildContext context) {
          return Container(
            height: 260.0,
            child: Text('I am text')
        );
      },
).whenComplete(() {
  print('Hey there, I\'m calling after hide bottomSheet');
});

Leave a Comment