deserialize method

dynamic deserialize(
  1. String jsonVal,
  2. String targetType
)

Implementation

dynamic deserialize(String jsonVal, String targetType) {
  // Remove all spaces.  Necessary for reg expressions as well.
  targetType = targetType.replaceAll(' ', '');
  if (targetType == 'String') return jsonVal;

  var decodedJson = json.decode(jsonVal);
  return _deserialize(decodedJson, targetType);
}