double_back_to_close_app
2.1.0, released 5 years ago by hugopassos.dev
Provides a widget that requires a double back press to exit the app on Android.
What it does
Wraps your UI in a widget that intercepts the Android back button. On first press it shows a SnackBar; a second press within a short interval closes the app. Handles SnackBar dismissal correctly.
AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want a simple double‑back‑to‑exit behavior on Android
- You need a lightweight solution without native code
Skip it when
- You need custom back‑navigation logic or iOS‑specific behavior
- You require more advanced exit handling or multiple back‑press actions
Strengths
- Very small and easy to integrate
- Handles SnackBar dismissal edge cases
- No platform‑specific setup
Weaknesses
- Works only on Android
- Limited customization of timing and UI
- May conflict with other back‑button handlers
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: DoubleBackToCloseApp(
child: Home(),
snackBar: const SnackBar(content: Text('Tap back again to leave')),
),
),
);
}
}Alternatives
Packages that do the same job and could replace double_back_to_close_app.
- dismissible_page
Widget that lets you dismiss a page in any direction with custom gestures
89Compare - syncfusion_flutter_datepicker
A Flutter widget for selecting single dates, multiple dates, or date ranges with various calendar views.
91Compare - feedback
Widget to collect annotated screenshots and text feedback from users
84Compare - feedback_sentry
Collect in‑app feedback and send it to Sentry.
68Compare