@@ -28,7 +28,10 @@ enum VariableType {
2828 list,
2929
3030 /// Map type. Represents a map.
31- map;
31+ map,
32+
33+ /// Image type. Represents an image URL.
34+ image;
3235
3336 /// Returns a string representation of the variable type.
3437 String get label => switch (this ) {
@@ -39,6 +42,7 @@ enum VariableType {
3942 VariableType .color => 'Color' ,
4043 VariableType .list => 'List' ,
4144 VariableType .map => 'Map' ,
45+ VariableType .image => 'Image' ,
4246 };
4347
4448 factory VariableType .fromObjectType (Object obj) {
@@ -76,6 +80,9 @@ enum VariableType {
7680
7781 /// Whether the variable type is [VariableType.text] .
7882 bool get isText => this == VariableType .text;
83+
84+ /// Whether the variable type is [VariableType.text] .
85+ bool get isImage => this == VariableType .image;
7986}
8087
8188/// Store information of a variable. [id] must not be empty when creating a
@@ -156,6 +163,7 @@ class VariableData
156163 /// Returns the value converted to the appropriate type according to [type] .
157164 Object ? getValue () => switch (type) {
158165 VariableType .text => value.isEmpty ? null : value,
166+ VariableType .image => value.isEmpty ? null : value,
159167 VariableType .integer => num .tryParse (value).toInt (),
160168 VariableType .decimal => num .tryParse (value).toDouble (),
161169 VariableType .boolean => bool .tryParse (value, caseSensitive: false ),
@@ -178,6 +186,7 @@ String? sanitizeValueForVariableType(Object? value, VariableType type) {
178186 if (value.toString ().contains (variablePathPattern)) return value.toString ();
179187 switch (type) {
180188 case VariableType .text:
189+ case VariableType .image:
181190 return value.toString ();
182191 case VariableType .integer:
183192 return num .tryParse (value.toString ()).toInt ()? .toString ();
0 commit comments