double_back_to_close
2.0.0, released 6 years ago by fuadarradhi.com
Flutter widget that requires double back-button presses to close an app, route, or screen.
WASM-ready
What it does
It wraps any widget and intercepts back button presses. Users must press the back button twice within a specified time window to successfully exit the screen or app, with support for custom messages, snackbars, and conditions.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to prevent accidental app exits when users press the back button on the home screen.
- You need custom handling or warnings on the first back press before closing a route.
Skip it when
- You are building for platforms or navigation flows where standard single back press is expected everywhere.
Strengths
- Simple widget wrapper usage
- Supports custom actions, snackbars, and flashbars via callbacks
- Includes customizable delay and conditional execution
Weaknesses
- Limited to back button interception use cases
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
DoubleBack(
message: "Press back again to close",
child: Home(),
)Alternatives
Packages that do the same job and could replace double_back_to_close.
- full_swipe_back_gesture
iOS-style full-screen back swipe gesture PageRoute that avoids horizontal scroll conflicts.
41Compare - no_context_navigation
Navigate without BuildContext using a global NavigatorKey
41Compare