setBrightness method

Future<void> setBrightness(
  1. double brightnes
)

Implementation

Future<void> setBrightness(double brightnes) async {
  if (!manageBrightness) {
    return;
  }
  if (!desktopOrWeb) {
    try {
      brightness.value = brightnes;
      ScreenBrightness().setScreenBrightness(brightnes);
      setUserPreferenceForBrightness();
    } catch (e) {
      customDebugPrint(e);
      throw 'Failed to set brightness';
    }
  }
}