mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 15:39:41 +00:00
Refactor JSON Serialization in UpdateSpaceParam: Adjusted the _toJson method for Subspace to ensure 'subspaceName' is always included and 'uuid' is only added when applicable, enhancing clarity and consistency in data representation.
This commit is contained in:
@ -34,7 +34,8 @@ extension _SubspaceToJson on Subspace {
|
||||
Map<String, dynamic> _toJson() {
|
||||
final isNewSubspace = uuid.endsWith('-NewTag');
|
||||
return <String, dynamic>{
|
||||
if (isNewSubspace) 'subspaceName': name else 'uuid': uuid,
|
||||
if (!isNewSubspace) 'uuid': uuid,
|
||||
'subspaceName': name,
|
||||
'productAllocations': productAllocations.map((e) => e._toJson()).toList(),
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user