double_back_to_close_app 2.1.0 copy "double_back_to_close_app: ^2.1.0" to clipboard
double_back_to_close_app: ^2.1.0 copied to clipboard

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

example/lib/main.dart

import 'package:double_back_to_close_app/double_back_to_close_app.dart';
import 'package:flutter/material.dart';

void main() => runApp(Example());

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: DoubleBackToCloseApp(
          snackBar: const SnackBar(
            content: Text('Tap back again to leave'),
          ),
          child: Center(
            child: OutlineButton(
              child: const Text('Tap to simulate back'),
              // ignore: invalid_use_of_protected_member
              onPressed: WidgetsBinding.instance!.handlePopRoute,
            ),
          ),
        ),
      ),
    );
  }
}
329
likes
150
pub points
96%
popularity

Publisher

verified publisherhugopassos.dev

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

flutter

More

Packages that depend on double_back_to_close_app