Flutter: checkBox onChanged
Instead of checking checkBoxValue & setting onPressed, you should check checkBoxValue inside your on press function then manage navigation.SO first remove this
if (checkBoxValue) { _floatButtonOnPressed = navToHome();}
Then update onPressed of floating action button as
onPressed: (){navToHome();},
Then update you navToHome()
function
navtoHome(){ if(checkValue){ //your navigation code here }}