turnOff static method

Future<bool> turnOff({
  1. bool withAllowLockWhileScreenOn = false,
})

Enables automatic screen off. (Reset to default.) It is recommended to call it with the dispose method of StatefulWidget.

If withAllowLockWhileScreenOn is set to true, the FLAG_ALLOW_LOCK_WHILE_SCREEN_ON flag is also cleared at the same time (Android only).

Implementation

static Future<bool> turnOff({ bool withAllowLockWhileScreenOn = false }) {
  return KeepScreenOnPlatform.instance.turnOff(
    withAllowLockWhileScreenOn: withAllowLockWhileScreenOn,
  );
}