background_on_back 1.0.1 copy "background_on_back: ^1.0.1" to clipboard
background_on_back: ^1.0.1 copied to clipboard

Flutter plugin to handle backgound the app on pressing back button instead of quitting app.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return PopScope(
        canPop: false,
        onPopInvokedWithResult: (didPop, result) {
          if (didPop) return;
          BackgroundOnBack.pop();
        },
        child: Scaffold(
          appBar: AppBar(title: const Text('Homepage')),
          body: Center(child: Text('Hassle free solution for android BACK press')),
        ),
      );
  }
}
1
likes
150
points
46
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to handle backgound the app on pressing back button instead of quitting app.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on background_on_back

Packages that implement background_on_back