onBackPressed method

Future<bool> onBackPressed({
  1. BuildContext? context,
})

onBackPressed returns false to stop propagating the event, true in other cases

Implementation

Future<bool> onBackPressed({BuildContext? context}) async {
  if (isDrawerOpen) {
    closeDrawer(context);
    return false;
  }
  _onBackVisit();
  return true;
}