getReader method
Implementation
Deserializer? getReader(final input, String? targetType) {
switch (targetType) {
case 'String':
return (value) => '$value';
case 'int':
return (value) => value is int ? value : int.parse('$value');
case 'bool':
return (value) =>
value is bool ? value : '$value'.toLowerCase() == 'true';
case 'double':
return (value) => value is double ? value : double.parse('$value');
case 'Duration':
return (value) => timeSpanOf('${value}');
case 'TimeSpan':
return (value) => timeSpanOf('${value}');
default:
return null;
}
}