screen_brightness
2.1.11, released 5 months ago by an unverified publisher
A Flutter plugin for controlling screen brightness with application lifecycle reset.
What it does
Allows getting and setting application and system screen brightness levels. Provides streams to listen for brightness changes and automatically handles resetting brightness based on app lifecycle.
AI-written summary of version 2.1.11, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to adjust screen brightness from within a Flutter app.
- You want to track system or application brightness changes using streams.
Skip it when
- You only need to prevent the screen from sleeping (use wakelock instead).
Strengths
- Supports multiple platforms including Android, iOS, Windows, macOS, and OHOS.
- Provides application lifecycle reset implementation.
- Includes brightness change streams.
Weaknesses
- Adjusting system brightness on Android requires adding the WRITE_SETTINGS permission.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 6
To adjust system brightness on Android, add the WRITE_SETTINGS permission in your AndroidManifest.xml file.
Future<void> setApplicationBrightness(double brightness) async {
try {
await ScreenBrightness.instance
.setApplicationScreenBrightness(brightness);
} catch (e) {
debugPrint(e.toString());
throw 'Failed to set application brightness';
}
}Alternatives
Packages that do the same job and could replace screen_brightness.
- flutter_overlay_window
Flutter plugin to display your app over other apps on the screen.
85Compare - screen_retriever
Read desktop screen size, work area, scale factor and cursor position on Windows, macOS and Linux.
93Compare - screen_corner_radius
Provides the corner radius value of the current device screen for Android and iOS.
47Compare - flutter_screen_wake
Manage device screen wake state and brightness on Android and iOS.
40Compare
Works with
Packages commonly used together with screen_brightness: ones it builds on, ones built on it, and its own family.