Wakelock class Null safety

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. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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. [...]
read-only

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. [...]