Last updated:
0 purchases
screen brightness util
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!");
}
copied to clipboard
Set Brightness #
double brightness = 0.5;
final ScreenBrightnessUtil _screenBrightnessUtil = ScreenBrightnessUtil();
bool success = await _screenBrightnessUtil.setBrightness(brightness);
copied to clipboard
Listen Brightness Change #
final ScreenBrightnessUtil _screenBrightnessUtil = ScreenBrightnessUtil();
StreamSubscription ss = _screenBrightnessUtil.getBrightnessChangeStream().listen((brightness) {
debugPrint("brightness:$brightness");
});
...
ss.cancel();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.