Skip to content

Commit 7144ed7

Browse files
committed
Add toggle option for set variable action of bool type.
1 parent ae25a12 commit 7144ed7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/src/api/models/action/set_variable_action.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ class SetVariableAction extends ActionModel
2222
/// Value that the variable needs to be updated with.
2323
final String newValue;
2424

25+
/// Whether to toggle the value of the variable instead of setting it
26+
/// if the variable is a boolean.
27+
final bool toggled;
28+
2529
/// Creates a new [SetValueAction].
2630
SetVariableAction({
2731
required this.variable,
2832
required this.newValue,
33+
this.toggled = false,
2934
}) : super(type: ActionType.setVariable);
3035

3136
@override
@@ -35,10 +40,12 @@ class SetVariableAction extends ActionModel
3540
SetVariableAction copyWith({
3641
VariableData? variable,
3742
String? newValue,
43+
bool? toggled,
3844
}) =>
3945
SetVariableAction(
4046
variable: variable ?? this.variable,
4147
newValue: newValue ?? this.newValue,
48+
toggled: toggled ?? this.toggled,
4249
);
4350

4451
/// Creates a new [SetVariableAction] instance from a JSON data.

0 commit comments

Comments
 (0)