|
|
|
@ -12,8 +12,9 @@ class OtaConfigResp { |
|
|
|
|
|
|
|
// 最终属性(不可变) |
|
|
|
final String? id; |
|
|
|
final String? factory; |
|
|
|
final String? equipmentname; |
|
|
|
final int? factory; |
|
|
|
final int? devicetype; |
|
|
|
final String? devicename; |
|
|
|
final String? systemversion; |
|
|
|
final String? updatepackageaddress; |
|
|
|
final String? updatedescription; |
|
|
|
@ -21,7 +22,8 @@ class OtaConfigResp { |
|
|
|
OtaConfigResp._({ |
|
|
|
this.id, |
|
|
|
this.factory, |
|
|
|
this.equipmentname, |
|
|
|
this.devicetype, |
|
|
|
this.devicename, |
|
|
|
this.systemversion, |
|
|
|
this.updatepackageaddress, |
|
|
|
this.updatedescription, |
|
|
|
@ -30,13 +32,14 @@ class OtaConfigResp { |
|
|
|
factory OtaConfigResp.fromJson(Map<String, dynamic> json) { |
|
|
|
print("数据获取fronTokenJson${json}"); |
|
|
|
// 修复1:安全获取嵌套的 user 字段 |
|
|
|
final infoData = json['info'] as Map<String, dynamic>?; // 允许空值 |
|
|
|
final infoData = json['product'] as Map<String, dynamic>?; // 允许空值 |
|
|
|
|
|
|
|
// 更新单例实例 |
|
|
|
return _instance = OtaConfigResp._( |
|
|
|
id: (infoData?['id'] as String?) ?? '', |
|
|
|
factory: (infoData?['factory'] as String?) ?? '', |
|
|
|
equipmentname: (infoData?['equipmentname'] as String?) ?? '', |
|
|
|
factory: (infoData?['factoryid'] as int?) ?? 0, |
|
|
|
devicetype: (infoData?['devicetype'] as int?) ?? 0, |
|
|
|
devicename: (infoData?['devicename'] as String?) ?? '', |
|
|
|
systemversion: (infoData?['systemversion'] as String?) ?? '', |
|
|
|
updatepackageaddress: |
|
|
|
(infoData?['updatepackageaddress'] as String?) ?? '', |
|
|
|
@ -49,7 +52,8 @@ class OtaConfigResp { |
|
|
|
'user': { |
|
|
|
'id': instance.id, |
|
|
|
'factory': instance.factory, |
|
|
|
'equipmentname': instance.equipmentname, |
|
|
|
'devicetype': instance.devicetype, |
|
|
|
'devicename': instance.devicename, |
|
|
|
'systemversion': instance.systemversion, |
|
|
|
'updatepackageaddress': instance.updatepackageaddress, |
|
|
|
'updatedescription': instance.updatedescription, |
|
|
|
|