updatePropsByState static method
Implementation
static Map<String, dynamic> updatePropsByState(
Map<String, dynamic> json,
String stateVariable,
) {
debugPrint("Entry Data1 $stateVariable: ${json.toString()}");
if (!json.containsKey(stateVariable)) {
return json;
}
final updatedJson = Map<String, dynamic>.from(json);
final stateProps = updatedJson[stateVariable] as Map<String, dynamic>;
final mainProps = updatedJson['props'] as Map<String, dynamic>;
stateProps.forEach((key, value) {
mainProps[key] = value;
});
debugPrint("Entry Data2 $stateVariable: ${json.toString()}");
return updatedJson;
}