screen_brightness_util 0.0.3 copy "screen_brightness_util: ^0.0.3" to clipboard
screen_brightness_util: ^0.0.3 copied to clipboard

A flutter plugin to config and monitor brightness. Support Windows, Android and iOS platform.

screen_brightness_util #

A flutter plugin to config and monitor brightness.

Getting Started #

Get Brightness #

final ScreenBrightnessUtil _screenBrightnessUtil = ScreenBrightnessUtil();
double brightness = await _screenBrightnessUtil.getBrightness();
if(brightness == -1) {
  debugPrint("Oops... something wrong!");
}

Set Brightness #

double brightness = 0.5;
final ScreenBrightnessUtil _screenBrightnessUtil = ScreenBrightnessUtil();
bool success = await _screenBrightnessUtil.setBrightness(brightness);

Listen Brightness Change #

final ScreenBrightnessUtil _screenBrightnessUtil = ScreenBrightnessUtil();
StreamSubscription ss = _screenBrightnessUtil.getBrightnessChangeStream().listen((brightness) {
  debugPrint("brightness:$brightness");
});

...

ss.cancel();