@@ -4,7 +4,8 @@ This plugin allows you to enable and toggle the Android and iOS screen wakelock,
## Getting Started
If you want to enable the wakelock, you can simply call `Wakelock.enableWakelock` and to disable it, you can use `Wakelock.disableWakelock`:
Everything in this plugin is controlled via the [`Wakelock` class](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock-class.html).
If you want to enable the wakelock, you can simply call [`Wakelock.enableWakelock`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/enableWakelock.html) and to disable it, you can use [`Wakelock.disableWakelock`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/disableWakelock.html):
```dart
import'package:wakelock/wakelock.dart';
...
...
@@ -17,7 +18,7 @@ Wakelock.enableWakelock();
Wakelock.disableWakelock();
```
For more advanced usage, you can pass a `bool` to `Wakelock.toggleWakelock` to enable or disable the wakelock and also retrieve the current wakelock status using `Wakelock.isWakelockEnabled`:
For more advanced usage, you can pass a `bool` to [`Wakelock.toggleWakelock`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/toggleWakelock.html) to enable or disable the wakelock and also retrieve the current wakelock status using [`Wakelock.isWakelockEnabled`](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock/isWakelockEnabled.html):
If you want to wait for the wakelock toggle on Android or iOS to complete (which takes an insignificant amount of time), you can also await either of `Wakelock.enableWakelock`, `Wakelock.disableWakelock`, and `Wakelock.toggleWakelock`.
## Note
This plugin is originally based on [`flutter_screen`](https://pub.dev/packages/screen).
Specifically, the wakelock functionality was extracted into this plugin due to a lack of maintenance.
This is a basic example demonstrating the functionality of the wakelock plugin, including enabling & disabling the wakelock and also retrieving the current wakelock status using a `FutureBuilder`.
See [`example/lib/main.dart`](https://github.com/creativecreatorormaybenot/wakelock/blob/master/example/lib/main.dart).