Showing
2 changed files
with
12 additions
and
4 deletions
| @@ -4,7 +4,8 @@ This plugin allows you to enable and toggle the Android and iOS screen wakelock, | @@ -4,7 +4,8 @@ This plugin allows you to enable and toggle the Android and iOS screen wakelock, | ||
| 4 | 4 | ||
| 5 | ## Getting Started | 5 | ## Getting Started |
| 6 | 6 | ||
| 7 | -If you want to enable the wakelock, you can simply call `Wakelock.enableWakelock` and to disable it, you can use `Wakelock.disableWakelock`: | 7 | +Everything in this plugin is controlled via the [`Wakelock` class](https://pub.dev/documentation/wakelock/latest/wakelock/Wakelock-class.html). |
| 8 | +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): | ||
| 8 | 9 | ||
| 9 | ```dart | 10 | ```dart |
| 10 | import 'package:wakelock/wakelock.dart'; | 11 | import 'package:wakelock/wakelock.dart'; |
| @@ -17,7 +18,7 @@ Wakelock.enableWakelock(); | @@ -17,7 +18,7 @@ Wakelock.enableWakelock(); | ||
| 17 | Wakelock.disableWakelock(); | 18 | Wakelock.disableWakelock(); |
| 18 | ``` | 19 | ``` |
| 19 | 20 | ||
| 20 | -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`: | 21 | +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): |
| 21 | 22 | ||
| 22 | ```dart | 23 | ```dart |
| 23 | import 'package:wakelock/wakelock.dart'; | 24 | import 'package:wakelock/wakelock.dart'; |
| @@ -34,4 +35,9 @@ Wakelock.toggleWakelock(enableWakelock); // This statement disables the wakelock | @@ -34,4 +35,9 @@ Wakelock.toggleWakelock(enableWakelock); // This statement disables the wakelock | ||
| 34 | bool isWakelockEnabled = await Wakelock.isWakelockEnabled; | 35 | bool isWakelockEnabled = await Wakelock.isWakelockEnabled; |
| 35 | ``` | 36 | ``` |
| 36 | 37 | ||
| 37 | -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`. | ||
| 38 | +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`. | ||
| 39 | + | ||
| 40 | +## Note | ||
| 41 | + | ||
| 42 | +This plugin is originally based on [`flutter_screen`](https://pub.dev/packages/screen). | ||
| 43 | +Specifically, the wakelock functionality was extracted into this plugin due to a lack of maintenance. |
| 1 | # Example | 1 | # Example |
| 2 | 2 | ||
| 3 | -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`. | ||
| 3 | +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`. | ||
| 4 | + | ||
| 5 | +See [`example/lib/main.dart`](https://github.com/creativecreatorormaybenot/wakelock/blob/master/example/lib/main.dart). |
-
Please register or login to post a comment