import 'package:syncrow_app/features/devices/model/status_model.dart'; class SosModel { String sosContactState; int batteryPercentage; SosModel({ required this.sosContactState, required this.batteryPercentage, }); factory SosModel.fromJson(List jsonList) { late String _sosContactState; late int _batteryPercentage; for (int i = 0; i < jsonList.length; i++) { if (jsonList[i].code == 'sos') { _sosContactState = jsonList[i].value ?? ''; } else if (jsonList[i].code == 'battery_percentage') { _batteryPercentage = jsonList[i].value ?? 0; } } return SosModel( sosContactState: _sosContactState, batteryPercentage: _batteryPercentage, ); } }