closeOnConfirm method
Implementation
bool closeOnConfirm() {
DateTime now = DateTime.now();
if (_currentBackPressTime == null ||
now.difference(_currentBackPressTime!) > const Duration(seconds: 2)) {
_currentBackPressTime = now;
showToast(message ?? 'Press back again to exit');
return false;
}
_currentBackPressTime = null;
return true;
}