decodeAs<T> method
Implementation
T? decodeAs<T>(String jsonVal) {
if (T == String) {
return jsonVal as T;
}
// Remove all spaces. Ne|cessary for reg expressions as well.
final targetType = "$T".replaceAll(' ', '');
var decodedJson = json.decode(jsonVal);
return _deserialize(decodedJson, targetType) as T?;
}