onWillPop method Null safety

Future<bool> onWillPop()

Implementation

Future<bool> onWillPop() async {
  FocusScope.of(context).requestFocus(new FocusNode());
  FocusScope.of(context).unfocus();

  if (popupKey.currentState?.closePopup() == true) {
    return Future.value(true);
  } else {
    return Future.value(false);
  }
}