This commit is contained in:
parent
c540f82761
commit
7e7af7658c
|
|
@ -55,7 +55,6 @@ class WindSpeedScreen extends StatelessWidget {
|
|||
.map((e) => {
|
||||
'timestamp': e.timestamp,
|
||||
'speed': e.speed,
|
||||
'pulse': e.pulse,
|
||||
})
|
||||
.toList();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,22 @@
|
|||
class MyWindSpeed {
|
||||
double speed;
|
||||
int pulse;
|
||||
|
||||
DateTime timestamp;
|
||||
|
||||
MyWindSpeed({
|
||||
required this.speed,
|
||||
required this.pulse,
|
||||
required this.timestamp,
|
||||
});
|
||||
MyWindSpeed({required this.speed, required this.timestamp});
|
||||
|
||||
static final empty = MyWindSpeed(
|
||||
speed: 0.0,
|
||||
pulse: 0,
|
||||
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(0),
|
||||
);
|
||||
|
||||
factory MyWindSpeed.fromJson(Map<dynamic, dynamic> json) {
|
||||
return MyWindSpeed(
|
||||
speed: (json['speed'] ?? 0).toDouble(),
|
||||
pulse: (json['pulse'] ?? 0) as int,
|
||||
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(
|
||||
(json['timesTamp'] ?? 0) * 1000, // kalau dari Unix detik
|
||||
(json['timestamp'] ?? 0) * 1000, // kalau dari Unix detik
|
||||
).toLocal(),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue