当我换课时如何阻止未来的延迟

I'm using a future.delayed in the iniState to show an alert dialog but sometimes I change the class before this time is the problem is that the alert is shown in another class so I want to stop the timer when I leave the class that's the code of the timernew

Future.delayed(Duration (seconds: 6), () {
      if(a==0)
      {showDialog(
          barrierDismissible: false,
          context: context,
          builder: (BuildContext context) {
            double width = MediaQuery.of(context).size.width;
            double height = MediaQuery.of(context).size.height;
         return   Dialog(
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(20.0)), //this right here
                child: Container(
                  height: 110,
                  child: Padding(
                    padding: EdgeInsets.all(0),
                    child: ListView(
                      children: ListTile.divideTiles(context: context, tiles: [
                        ListTile(
                          title: Text(
                            'Vous n\'etes pas connecter a BLuetooth essayer de le faire et repetez le test',

                            textAlign: TextAlign.center,
                            style: TextStyle(
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                          onTap: null,
                        ),
                        ListTile(
                          title: Text('OK',textAlign: TextAlign.center,style: TextStyle(color: Colors.lightBlueAccent),)
                          ,onTap: (){
                            globals.Data.etatbluetooth('0');
                            Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => resultat()),
        );
                        },
                        )



                      ]).toList(),
                    ),
                  ),
                )
            );

      }
      );}
      else{
        globals.Data.etatbluetooth('1');
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) => resultat()),
        );
      }
    });

所以,如果我离开班级,我该如何停止它,谢谢