Wakelock class

Class providing all wakelock functionality using static members.

To enable the wakelock, you can use Wakelock.enable and to disable it, you can call Wakelock.disable. You do not need to worry about making redundant calls, e.g. calling Wakelock.enable when the wakelock is already enabled as the plugin handles this for you, i.e. it checks the status to determine if the wakelock is already enabled or disabled. If you want the flexibility to pass a bool to control whether the wakelock should be enabled or disabled, you can use Wakelock.toggle.

The Wakelock.enabled getter allows you to retrieve the current wakelock status of the device..

Constructors

Wakelock()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

enabled Future<bool>
Returns whether the wakelock is currently enabled or not.
no setter

Static Methods

disable() Future<void>
Disables the wakelock.
enable() Future<void>
Enables the wakelock.
toggle({required bool enable}) Future<void>
Toggles the wakelock on or off.