Programmatically click on home button and turn off screen in flutter

562

Sadly, it is not possible to turn off the screen in Flutter, however you can perform system actions:

Use this library:

system_shortcuts: ^1.0.0

Import it like this:

import 'package:system_shortcuts/system_shortcuts.dart';

And then you can call:

await SystemShortcuts.home();

Please note however that this requires your function in which you call it to be async

Share:
562
Ali Nour
Author by

Ali Nour

Updated on December 28, 2022

Comments

  • Ali Nour
    Ali Nour over 1 year

    How can access programmatically home and power buttons ,I know that that turning screen off is only accessed by system apps in android , but what about moving to home screen ,can it accessed programmatically from flutter and if not are there any plugins that can do that action.