baseReflectableConverter static method
Implementation
static Map<String, Object?> baseReflectableConverter(Type originType,
Map<String, Object?> jsonMap,
Map<TypeCheck, Object? Function(dynamic value)> typeMap) {
const reflector = Reflector();
ClassMirror mirror = reflector.reflectType(originType) as ClassMirror;
mirror.declarations.forEach((key, value) {
if (value is VariableMirror) {
var unserializer = typeMap.entries
.firstWhereOrNull(
(type) => type.key.matchesType(value.reflectedType))
?.value;
if (unserializer != null) {
jsonMap[key] = unserializer(jsonMap[key]);
}
}
});
return jsonMap;
}