mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 21:44:55 +00:00
@ -55,8 +55,7 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
||||
) async {
|
||||
emit(WallSensorLoadingInitialState());
|
||||
try {
|
||||
final response =
|
||||
await DevicesManagementApi().getBatchStatus(event.devicesIds);
|
||||
final response = await DevicesManagementApi().getBatchStatus(event.devicesIds);
|
||||
deviceStatus = WallSensorModel.fromJson(response.status);
|
||||
emit(WallSensorUpdateState(wallSensorModel: deviceStatus));
|
||||
} catch (e) {
|
||||
@ -69,9 +68,9 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
|
||||
final ref = FirebaseDatabase.instance.ref('device-status/$deviceId');
|
||||
|
||||
ref.onValue.listen((event) {
|
||||
final eventsMap = event.snapshot.value! as Map<dynamic, dynamic>;
|
||||
final eventsMap = event.snapshot.value as Map<dynamic, dynamic>;
|
||||
|
||||
final statusList = <Status>[];
|
||||
List<Status> statusList = [];
|
||||
eventsMap['status'].forEach((element) {
|
||||
statusList.add(
|
||||
Status(code: element['code'], value: element['value']),
|
||||
|
||||
Reference in New Issue
Block a user