@@ -64,18 +64,20 @@ class ViewUtil {
64
64
static WidgetModel buildModel (
65
65
dynamic item, Map <String , dynamic >? customWidgetMap) {
66
66
String ? widgetType;
67
- YamlMap ? payload;
67
+ Map ? payload;
68
68
SourceSpan def =
69
69
SourceSpanBase (SourceLocationBase (0 ), SourceLocationBase (0 ), '' );
70
70
// name only e.g Spacer
71
71
if (item is String ) {
72
72
widgetType = item;
73
- } else if (item is YamlMap ) {
73
+ } else if (item is Map ) {
74
74
widgetType = item.keys.first.toString ();
75
- if (item[widgetType] is YamlMap ) {
75
+ if (item[widgetType] is Map ) {
76
76
payload = item[widgetType];
77
77
}
78
- def = getDefinition (item);
78
+ if (item is YamlMap ) {
79
+ def = getDefinition (item);
80
+ }
79
81
if (item.keys.length > 1 ) {
80
82
//multiple widgets found, it is probably because user used wrong indentation
81
83
//TODO: we'll send a warning back
@@ -151,7 +153,7 @@ class ViewUtil {
151
153
}
152
154
153
155
static WidgetModel ? buildCustomModel (
154
- YamlMap ? callerPayload,
156
+ Map ? callerPayload,
155
157
dynamic viewDefinition,
156
158
String widgetType,
157
159
Map <String , dynamic > customWidgetMap) {
@@ -166,13 +168,13 @@ class ViewUtil {
166
168
}
167
169
168
170
Map <String , dynamic > inputPayload = {};
169
- if (callerPayload? ['inputs' ] is YamlMap ) {
171
+ if (callerPayload? ['inputs' ] is Map ) {
170
172
callerPayload! ['inputs' ].forEach ((key, value) {
171
173
inputPayload[key] = value;
172
174
});
173
175
}
174
176
Map <String , EnsembleAction ?> eventPayload = {};
175
- if (callerPayload? ['events' ] is YamlMap ) {
177
+ if (callerPayload? ['events' ] is Map ) {
176
178
callerPayload! ['events' ].forEach ((key, value) {
177
179
eventPayload[key] = EnsembleAction .fromYaml (value);
178
180
});
@@ -191,7 +193,7 @@ class ViewUtil {
191
193
inputParams.add (input.toString ());
192
194
}
193
195
}
194
- if (entry.key == 'events' && entry.value is YamlMap ) {
196
+ if (entry.key == 'events' && entry.value is Map ) {
195
197
for (var event in entry.value.entries) {
196
198
eventParams[event.key] =
197
199
EnsembleEvent .fromYaml (event.key, event.value);
@@ -218,8 +220,8 @@ class ViewUtil {
218
220
219
221
// custom widgets can have styles too
220
222
Map <String , dynamic > styles = {};
221
- if (callerPayload? ["styles" ] is YamlMap ) {
222
- (callerPayload! ["styles" ] as YamlMap ).forEach ((styleKey, styleValue) {
223
+ if (callerPayload? ["styles" ] is Map ) {
224
+ (callerPayload! ["styles" ] as Map ).forEach ((styleKey, styleValue) {
223
225
styles[styleKey] = EnsembleThemeManager .yamlToDart (styleValue);
224
226
});
225
227
}
0 commit comments