fluttercommunity / fluttercommunity/wakelock_plus
show use of try block in examples.
Open
- Dominant language
- Dart
- Stars
- 109
- Forks
- 97
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 2
Description
Thanks for the package.
Just some feedback on the doco.
Every example of calling enable or disable should be awaited.
Whilst technically you don't need to await them it's considered best practice to await or explicitly unawait any async calls.
The examples should also show a try block around any enable/disable calls to ensure that the disable method is called even if an exception is thrown.
```dart
await WakelockPlus.enable();
try {
/// do something and an exception might be thrown
}
finally {
/// ensure the wake lock is relased.
await WakelockPlus.disable();
}
```
Contributor guide
Assessment
This issue has not been assessed yet.