ambient_light
0.2.1, released 4 months ago by an unverified publisher
Access ambient light sensor data on Android, iOS and macOS.
What it does
A Flutter plugin that enables applications to retrieve the current ambient light level and listen to continuous light sensor updates. It supports Android, iOS, and macOS platforms.
AI-written summary of version 0.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to adjust app UI brightness based on the user's environment
- You want to stream continuous ambient light data
Skip it when
- You need a broader sensor suite like accelerometer or gyroscope
- You need to support web interface (web support is dropped)
Strengths
- Supports multiple platforms including Android, iOS, and macOS
- Provides both a one-time retrieval method and a continuous data stream
Weaknesses
- Web interface is no longer supported
- Requires platform-specific configuration such as camera usage description on iOS
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
For iOS, you need to add the NSCameraUsageDescription key to your Info.plist file to request access to the camera for measuring ambient light.
import 'package:ambient_light/ambient_light.dart';
void main() async {
final AmbientLight _ambientLight = AmbientLight();
double? lightLevel = await _ambientLight.currentAmbientLight();
}Alternatives
Packages that do the same job and could replace ambient_light.
- sensors_plus
Pick sensors_plus if you need standard device sensors like accelerometer, magnetometer, gyroscope, or user acceleration.
96Compare
Works with
Packages commonly used together with ambient_light: ones it builds on, ones built on it, and its own family.