mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 10:34:54 +00:00
@ -56,7 +56,7 @@ class SpaceModel {
|
||||
{String? parentInternalId}) {
|
||||
final String internalId = json['internalId'] ?? const Uuid().v4();
|
||||
|
||||
final children = json['children'] != null
|
||||
final List<SpaceModel> children = json['children'] != null
|
||||
? (json['children'] as List).map((childJson) {
|
||||
return SpaceModel.fromJson(
|
||||
childJson,
|
||||
@ -73,8 +73,8 @@ class SpaceModel {
|
||||
isPrivate: json['isPrivate'] ?? false,
|
||||
invitationCode: json['invitationCode'],
|
||||
subspaces: (json['subspaces'] as List<dynamic>?)
|
||||
?.whereType<Map<String, dynamic>>() // Validate type
|
||||
.map(SubspaceModel.fromJson)
|
||||
?.where((e) => e is Map<String, dynamic>) // Validate type
|
||||
.map((e) => SubspaceModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
parent: parentInternalId != null
|
||||
@ -102,8 +102,8 @@ class SpaceModel {
|
||||
? SpaceTemplateModel.fromJson(json['spaceModel'])
|
||||
: null,
|
||||
tags: (json['productAllocations'] as List<dynamic>?)
|
||||
?.whereType<Map<String, dynamic>>() // Validate type
|
||||
.map(Tag.fromJson)
|
||||
?.where((item) => item is Map<String, dynamic>) // Validate type
|
||||
.map((item) => Tag.fromJson(item as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
);
|
||||
@ -150,7 +150,7 @@ class SpaceModel {
|
||||
|
||||
extension SpaceExtensions on SpaceModel {
|
||||
List<String> listAllTagValues() {
|
||||
final tagValues = <String>[];
|
||||
final List<String> tagValues = [];
|
||||
|
||||
if (tags != null) {
|
||||
tagValues.addAll(
|
||||
@ -174,10 +174,10 @@ extension SpaceExtensions on SpaceModel {
|
||||
|
||||
bool isNoChangesSubmited(String name, icon, SpaceTemplateModel? spaceModel,
|
||||
List<SubspaceModel>? subspaces, List<Tag>? tags) {
|
||||
return name == this.name &&
|
||||
return (name == this.name &&
|
||||
icon == this.icon &&
|
||||
spaceModel == this.spaceModel &&
|
||||
subspaces == this.subspaces &&
|
||||
tags == this.tags;
|
||||
tags == this.tags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user