title: Capturing the event of showModelBottomSheet closing
body: <p>I have been learning flutter for sometime now.
  I am developing an application and I am stuck with a problem now.</p>
  <pre><code>                   showModalBottomSheet(
                         context: context,
                         builder: (context) {
                           return StatefulBuilder(
                              builder: (BuildContext context, StateSetter bottomsheetstate){
                           return buildSheet(context, script,bottomsheetstate);
                           });
                         },
                         isScrollControlled: true,
                         shape: RoundedRectangleBorder(
                             borderRadius: BorderRadius.vertical(
                                 top: Radius.circular(15.0)
                             )
                         ),
                     ).whenComplete((){
                       SSEClient.unsubscribeFromSSE();
                     });
                   },
  </code></pre>
  <p>the whencomplete((){}); function worked when the builder was returning a regular widget (say a container) but when I changed it to return a stateful widget, the whencomplete((){}); function is not working anymore. I am puzzled by this. I want to know what is happening behind the scene and a solution to this problem.</p>
  <p>thanks in advance!</p>