Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter deactivate screen timeout

Tags:

flutter

dart

How to deactivate screen timeout in Flutter?

like image 773
Fritjof Avatar asked Aug 14 '18 16:08

Fritjof


1 Answers

You can do it using this Flutter package : https://pub.dartlang.org/packages/screen

On Android you will have to add a new permission on your AndroidManifest.xml file

<uses-permission android:name="android.permission.WAKE_LOCK" />

Install de plugin

Add this dependency in your pubspec.yaml file

screen: ^0.0.3

And use it in your dart files:

import 'package:screen/screen.dart';

// Prevent screen from going into sleep mode:
Screen.keepOn(true);
like image 146
diegoveloper Avatar answered Oct 03 '22 03:10

diegoveloper