import 'package:syncrow_app/features/devices/model/status_model.dart'; class CurtainModel { String control; int percent; CurtainModel({ required this.control, required this.percent, }); factory CurtainModel.fromJson(List jsonList) { String _control = ''; int _percent = 0; for (int i = 0; i < jsonList.length; i++) { if (jsonList[i].code == 'control') { _control = jsonList[i].value ?? ''; } if (jsonList[i].code == 'percent_control') { _percent = jsonList[i].value ?? 0; } } //percent_control return CurtainModel( control: _control, percent: _percent, ); } }