m3_lightmeter/lib/data/light_sensor_service.dart

15 lines
315 B
Dart

import 'package:light_sensor/light_sensor.dart';
class LightSensorService {
const LightSensorService();
Future<bool> hasSensor() async {
try {
return await LightSensor.hasSensor ?? false;
} catch (_) {
return false;
}
}
Stream<int> luxStream() => LightSensor.lightSensorStream;
}