getx
getx copied to clipboard
Physical Back button Closing whole application
Expected Result
- Navigate to Previous page
Actual Result
- Closing whole application
To Reproduce : Wrap that page's Scaffold in a WillPopScope widget
return new WillPopScope(
onWillPop: () async {
return true;
},
child: new Scaffold(
…
),
);
GetX Version get: ^5.0.0-beta.52
[✓] Flutter (Channel stable, 3.3.0, on Ubuntu 21.04 5.11.0-49-generic, locale en_IN) • Flutter version 3.3.0 on channel stable at /home/pradeep/snap/flutter/common/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ffccd96b62 (8 days ago), 2022-08-29 17:28:57 -0700 • Engine revision 5e9e0e0aa8 • Dart version 2.18.0 • DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1) • Android SDK at /home/pradeep/Android/Sdk • Platform android-33, build-tools 33.0.0-rc1 • Java binary at: /snap/android-studio/123/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted.
[✓] Chrome - develop for the web • Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) • cmake version 3.10.2 • ninja version 1.8.2 • pkg-config version 0.29.1
[✓] Android Studio (version 2021.2) • Android Studio at /snap/android-studio/123/android-studio • Flutter plugin version 70.0.2 • Dart plugin version 212.5744 • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] HTTP Host Availability • All required HTTP hosts are available
• No issues found!
@pradeep14598 did you find the solution to this issue, I'm also facing this issue in nested navigation, and also there is no official documentation of navigator 2.0 using Getx.
@pradeep14598 did you find the solution to this issue, I'm also facing this issue in nested navigation, and also there is no official documentation of navigator 2.0 using Getx.
No i am still facing same issue,if you got any solution post in this comment let me know
@pradeep14598 did you find the solution to this issue, I'm also facing this issue in nested navigation, and also there is no official documentation of navigator 2.0 using Getx.
No i am still facing same issue,if you got any solution post in this comment let me know
Did you find the example from getx repository ?
I found the example project from Getx GitHub repo. In that example they didn't handle this back pressed button in android.
@override
Future<bool> popRoute({
Object? result,
PopMode? popMode,
}) async {
//Returning false will cause the entire app to be popped.
final wasPopup = await handlePopupRoutes(result: result);
if (wasPopup) return true;
final _popped = await _pop(popMode ?? backButtonPopMode, result);
notifyListeners();
if (_popped != null) {
//emulate the old pop with result
return true;
}
return false;
}
when backbutton pressed, await _pop(popMode ?? backButtonPopMode, result)
always return null, then popRoute retrun false
I solved it by upgrading the Flutter version to the newest (3.7.10 at the moment).