[Flutter Error] Unhandled Exception: type 'Null' is not a subtype of type 'FutureOr<Widget>'

Elen li·2021년 6월 3일
0
Future<Widget> _onBackPress(
      BuildContext context, PharmacyProvider pharmacyModel) async {
    return await showDialog(
      context: context,
      barrierDismissible: false,
      useRootNavigator: false,
      builder: (context) {
        return AlertDialog(
          title: Text(
            "등록 취소",
            textAlign: TextAlign.center,
          ),
          content: Text(
            "처음화면으로 돌아갑니다.",
            style: TextStyle(fontWeight: FontWeight.normal),
            textAlign: TextAlign.center,
          ),
          actions: [
            TextButton(
              child: Text("취소"),
              onPressed: () {
                OoNavigator.pop(context);
              },
            ),
            TextButton(
              child: Text("확인"),
              onPressed: () {
                if (!pharmacyModel.isSaved) {
                  pharmacyModel.selectedPharmacy = {};
                }

                OoNavigator.popInitPage(context);
              },
            )
          ],
        );
      },
    );
  }
Future<void> _onBackPress() {
	return await showDialog<Null>(
    	...
    );
}

참조 링크: flutter

profile
Android, Flutter 앱 개발자입니다.

0개의 댓글