onSessionOpened method
Session-open hook (PowerAssertionHold.session): the explicit opt-in that holds the machine awake for the whole session, runs and idle stretches alike.
Implementation
Future<void> onSessionOpened() async {
if (hold != PowerAssertionHold.session) return;
await acquire();
}