A Flutter package that allows Android users to press the back-button twice to close the app

  packages, Packages

double_back_to_close_app

A Flutter package that allows Android users to press the back-button twice to close the app.

Demo

Usage

Inside a Scaffold that wraps all your Widgets, place the DoubleBackToCloseApp passing a SnackBar:

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'),
          ),
        ),
      ),
    );
  }
}

Download Flutter package for double back to close app source code on GitHub

https://github.com/hcbpassos/double_back_to_close_app