mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
removed unnecesary type annotations from FirebaseRealtimeDeviceService
.
This commit is contained in:
@ -8,7 +8,7 @@ class FirebaseRealtimeDeviceService implements RealtimeDeviceService {
|
||||
try {
|
||||
final ref = FirebaseDatabase.instance.ref('device-status/$deviceId');
|
||||
|
||||
return ref.onValue.asyncMap((DatabaseEvent event) {
|
||||
return ref.onValue.asyncMap((event) {
|
||||
final data = event.snapshot.value as Map<dynamic, dynamic>?;
|
||||
|
||||
if (data == null || data['status'] == null) {
|
||||
@ -16,14 +16,14 @@ class FirebaseRealtimeDeviceService implements RealtimeDeviceService {
|
||||
}
|
||||
|
||||
final statusMap = data['status'] as List<dynamic>;
|
||||
return statusMap.map((dynamic status) {
|
||||
return statusMap.map((status) {
|
||||
if (status is! Map<dynamic, dynamic>) {
|
||||
throw Exception('Invalid status format');
|
||||
}
|
||||
|
||||
return Status(
|
||||
code: status['code']?.toString() ?? '',
|
||||
value: num.tryParse(status['value']?.toString() ?? '0') ,
|
||||
value: num.tryParse(status['value']?.toString() ?? '0'),
|
||||
);
|
||||
}).toList();
|
||||
});
|
||||
|
Reference in New Issue
Block a user