로딩
요청 처리 중입니다...

[Flutter] 플러터 뒤로가기 두번 앱 종료

 [Flutter] 플러터 뒤로가기 두번 앱 종료

WillPopScope UI 단 WillPopScope( onWillPop: () async => controller.handleWillPopScopeAction(), child: const Text("메인"), ) 컨트롤러 // 현재 시간 DateTime currentDateTime = DateTime.now(); // 뒤로가기 종료 Future handleWillPopScopeAction() async { DateTime now = DateTime.now(); if (now.difference(currentDateTime) > const Duration(milliseconds: 1000)) { currentDateTime = now; Fluttertoast.showToast( msg: "한번 더 누르면 앱이 종료됩니다", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, ), } else { exit(0);...

# backbutton # flutter # willpopscope # 뒤로가기 # 뒤로가기종료 # 앱종료 # 종료 # 플러터