Skip to content

Commit 7d0776d

Browse files
committed
Conditions #35
- Remove isUsed and nodes properties from VariableData model. - Implement methods to find usages for variables in nodes, conditions and actions. - Refactor usages of isUsed and nodes properties of VariableData to use find usages methods. - Refactor api builder code to use find usages methods.
1 parent f0cfeb6 commit 7d0776d

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

lib/src/api/models/variables_model.dart

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ class VariableData
5252
/// Name of the variable. This must be unique within a scope.
5353
final String name;
5454

55-
/// Nodes where this variable is used. This is used to determine whether
56-
/// a variable is used or not.
57-
final Set<String> nodes;
58-
5955
/// Default value this variable. This can be an empty string if no value is
6056
/// explicitly provided by the user.
6157
final String value;
@@ -64,23 +60,13 @@ class VariableData
6460
/// Type of the variable. This is used to determine how to parse the value.
6561
final VariableType type;
6662

67-
/// This denotes whether the variable is used anywhere or not. The system
68-
/// can't determine this automatically so an update method must be called
69-
/// on the corresponding scope to update this value. This is primarily used
70-
/// for REST API as it is easier to gather info about usages. It is not
71-
/// necessary to update this for editor variables as it is not intended for
72-
/// it.
73-
bool isUsed;
74-
7563
/// Creates a new [VariableData].
7664
VariableData({
7765
required this.id,
7866
required this.name,
7967
this.value = '',
80-
this.isUsed = true,
8168
this.type = VariableType.text,
82-
Set<String>? nodes,
83-
}) : nodes = nodes ?? <String>{};
69+
});
8470

8571
/// Duplicate a [VariableData] with the given parameters.
8672
VariableData copyWith({
@@ -96,12 +82,10 @@ class VariableData
9682
name: name ?? this.name,
9783
value: value ?? this.value,
9884
type: type ?? this.type,
99-
isUsed: isUsed ?? this.isUsed,
100-
nodes: nodes ?? this.nodes,
10185
);
10286

10387
@override
104-
List<Object?> get props => [id, name, value, type, nodes];
88+
List<Object?> get props => [id, name, value, type];
10589

10690
@override
10791
int compareTo(VariableData other) => name.compareTo(other.name);
@@ -121,8 +105,6 @@ class VariableData
121105
name: name,
122106
value: value,
123107
type: type,
124-
isUsed: isUsed,
125-
nodes: nodes,
126108
);
127109

128110
/// Converts [value] to given type [T]. This will fail if type conversion
@@ -235,8 +217,6 @@ class CanvasVariableData extends VariableData {
235217
required super.name,
236218
required super.type,
237219
super.value,
238-
super.isUsed,
239-
super.nodes,
240220
});
241221

242222
@override
@@ -255,8 +235,6 @@ class CanvasVariableData extends VariableData {
255235
type: type ?? this.type,
256236
id: id ?? this.id,
257237
canvasId: canvasId ?? this.canvasId,
258-
isUsed: isUsed ?? this.isUsed,
259-
nodes: nodes ?? this.nodes,
260238
);
261239

262240
@override

lib/src/api/models/variables_model.g.dart

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)