Wakelock class

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.isEnabled property allows you to retrieve the current wakelock status from Android or iOS.

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
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited

Static Properties

isEnabled Future<bool>
If you want to retrieve the current wakelock status, you will have to call Wakelock.isEnabled and await its result: bool isEnabled = await Wakelock.isEnabled()
read-only

Static Methods

disable() Future<void>
This can simply be called using Wakelock.disable() and does not return anything. You can await the Future to wait for the operation to complete.
enable() Future<void>
This can simply be called using Wakelock.enable() and does not return anything. You can await the Future to wait for the operation to complete.
toggle({bool on}) Future<void>
You can simply use this function to toggle the wakelock using a bool value. [...]