resolve method
Creates an action from the given arguments.
Implementation
Action resolve(dynamic data) {
// If the data is not a map, check if the action has a short-hand. If it
// does, then we can assume that the data is the short-hand value.
if (data is! Map<String, dynamic>) {
if (shortHand != null) {
return Function.apply(actionFactory, [], {shortHand!: data}) as Action;
}
if (data == null) {
return Function.apply(actionFactory, []) as Action;
}
throw Exception('Invalid data type: ${data.runtimeType}');
}
final namedParameters = data.map((key, value) {
for (final alias in aliases) {
if (alias.aliases.contains(key)) {
return MapEntry(alias.key, value);
}
}
return MapEntry(Symbol(key), value);
});
return Function.apply(actionFactory, [], namedParameters) as Action;
}