How can I make the back button work in android the same way as home. If I click on back, the application is killed, but I need the back button to work the same way as home, that is, just hide the application with the state saved. I know that it is possible to track the pressing of the back button using the WillPopScope widget in the onWillPop method, but how can I make the application collapse?
I found the system_shortcuts package, but it is already outdated and does not support null safety for my project.
Problem with system_shortcuts: i just add in pubspec system_shortcuts: ^1.0.0 and in my dart file import 'package:system_shortcuts/system_shortcuts.dart';
console: Error: Cannot run with sound null safety, because the following dependencies don't support null safety:
- package:system_shortcuts
For solutions, see https://dart.dev/go/unsound-null-safety 3
FAILURE: Build failed with an exception.
Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
- Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.