Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
flutter_wakelock
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
creativecreatorormaybenot
2022-01-26 18:56:18 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2022-01-26 18:56:18 +0000
Commit
7612965f21fb6a9cd26b66d2d6e45ef5332ec662
7612965f
1 parent
2caeaaf4
Document how to use wakelock in `main` (#168)
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletions
wakelock/CHANGELOG.md
wakelock/README.md
wakelock/pubspec.yaml
wakelock/CHANGELOG.md
View file @
7612965
## 0.6.1+1
*
Documented necessity of ensuring that the
`WidgetsBinding`
is initialized.
## 0.6.1
*
Fixed infinite loop on iOS.
...
...
wakelock/README.md
View file @
7612965
...
...
@@ -68,6 +68,24 @@ bool wakelockEnabled = await Wakelock.enabled;
If you want to wait for the wakelock toggle to complete (which takes an insignificant amount of
time), you can also
`await` any of `Wakelock.enable`, `Wakelock.disable`, and `Wakelock.toggle`
.
### Ensure the `WidgetsBinding` is initialized
If you want to call
`Wakelock.enable()` or the other functions before `runApp()` (e.g. in `main()`
),
you will have to ensure that the
`WidgetsBinding`
is initialized first:
```
dart
void
main
(
)
{
WidgetsFlutterBinding
.
ensureInitialized
();
Wakelock
.
enable
();
runApp
(..);
}
```
In general, it is advisable to make your wakelock dependent on certain components within your app
instead, e.g. by only enabling it (continually) when a certain widget is visible.
There is no negative impact in calling
`Wakelock.enable()`
more often.
## Learn more
If you want to learn more about how this plugin works, how to contribute, etc., you can read through
...
...
wakelock/pubspec.yaml
View file @
7612965
...
...
@@ -2,7 +2,7 @@ name: wakelock
description
:
>-2
Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on
Android, iOS, macOS, Windows, and web.
v
ersion: 0.6.1
v
ersion: 0.6.1
+1
r
epository: https://github.com/creativecreatorormaybenot/wakelock/tree/main/wakelock
e
nvironment:
...
...
Please
register
or
login
to post a comment