Programmatically click on home button and turn off screen in flutter

Viewed 672

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.

1 Answers

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

Related