checkIfResource function

Map<String, dynamic> checkIfResource(
  1. Map<String, dynamic> oldValue,
  2. String oldType
)

Implementation

Map<String, dynamic> checkIfResource(
    Map<String, dynamic> oldValue, String oldType) {
  if (oldValue.keys.length == 1 &&
      resourceTypeFromStringMap.keys.contains(oldValue.keys.first) &&
      oldValue.values.first is Map) {
    oldType = oldValue.keys.first;
    oldValue = oldValue.values.first as Map<String, dynamic>;
    oldValue['resourceType'] = oldType;
  }
  return <String, dynamic>{oldType: oldValue};
}