deserialize method
Deserialize the response into the target type.
Implementation
dynamic deserialize(String jsonVal, String targetType) {
// Remove all spaces. Necessary for reg expressions as well.
targetType = targetType.replaceAll(' ', '');
if (targetType == 'String') {
return jsonVal;
}
final decodedJson = json.decode(jsonVal);
return _deserialize(decodedJson, targetType);
}