record lux_fast and lux _slow
This commit is contained in:
@@ -3,9 +3,13 @@ import 'dart:ffi';
|
||||
class LightSensorEvent {
|
||||
final double lux;
|
||||
final int timestamp;
|
||||
LightSensorEvent(this.lux, this.timestamp);
|
||||
final double lux_fast;
|
||||
final double lux_slow;
|
||||
LightSensorEvent(this.lux, this.timestamp, this.lux_fast, this.lux_slow);
|
||||
Map<String, dynamic> toJson() => {
|
||||
'lux': lux,
|
||||
'timestamp': timestamp,
|
||||
'lux': lux,
|
||||
'lux_fast': lux_fast,
|
||||
'lux_slow': lux_slow,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
|
||||
Stream<LightSensorEvent> streamSensorEventFromNative() {
|
||||
const eventChannel = EventChannel('tw.moonjuice.light_sensor.stream');
|
||||
return eventChannel
|
||||
.receiveBroadcastStream()
|
||||
.map((event) => LightSensorEvent(event['lux'], event['timestamp']));
|
||||
return eventChannel.receiveBroadcastStream().map((event) =>
|
||||
LightSensorEvent(event['lux'], event['timestamp'], event['lux_fast'],
|
||||
event['lux_slow']));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user