Skip to content

Commit 4bd5a35

Browse files
committed
Conditions #16
- Implement variable substitution for conditions.
1 parent a16112d commit 4bd5a35

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

lib/src/api/models/condition.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ sealed class ExpressionPart with EquatableMixin, SerializableMixin {
139139
@JsonSerializable()
140140
class RawValuePart extends ExpressionPart {
141141
/// value of the raw value.
142-
final dynamic value;
142+
final String value;
143143

144144
/// Creates a raw value part.
145145
RawValuePart(this.value);
@@ -159,6 +159,10 @@ class RawValuePart extends ExpressionPart {
159159
/// `a` and `b`.
160160
@JsonSerializable()
161161
class VariablePart extends ExpressionPart {
162+
@JsonKey(defaultValue: '')
163+
/// the actual string interpolated with variables.
164+
final String valueString;
165+
162166
/// name of the variable
163167
final String variableName;
164168

@@ -168,6 +172,7 @@ class VariablePart extends ExpressionPart {
168172
/// Creates a variable part.
169173
VariablePart({
170174
required this.variableName,
175+
required this.valueString,
171176
this.jsonPath,
172177
});
173178

@@ -179,10 +184,12 @@ class VariablePart extends ExpressionPart {
179184
/// Duplicates the variable part with the provided values.
180185
VariablePart copyWith({
181186
String? variableName,
187+
String? valueString,
182188
String? jsonPath,
183189
}) {
184190
return VariablePart(
185191
variableName: variableName ?? this.variableName,
192+
valueString: valueString ?? this.valueString,
186193
jsonPath: jsonPath ?? this.jsonPath,
187194
);
188195
}

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

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

0 commit comments

Comments
 (0)