parseActionMap function
Implementation
Map<String, dynamic> parseActionMap({
required Map<String, dynamic> raw,
required String actionPath,
}) {
final parsedActions = <String, dynamic>{};
for (final entry in raw.entries) {
final key = entry.key;
final value = entry.value as Map<String, dynamic>;
final path = actionPath.isEmpty ? key : '$actionPath.$key';
if (value['\$type'] == 'action') {
final rawParams = value['params'] as Map<String, dynamic>;
parsedActions[key] = ActionEntry(
actionId: path,
name: key,
params: {
for (final entry in rawParams.entries)
// ignore: invalid_use_of_internal_member
entry.key: ParamSpec.internal(
type: ParamType.values
.firstWhere((t) => t.name == entry.value['type']),
required: entry.value['required'],
defaultValue: entry.value['defaultValue'],
),
},
);
} else {
parsedActions[key] = parseActionMap(
raw: value,
actionPath: path,
);
}
}
return parsedActions;
}