fromJson method

dynamic fromJson(
  1. dynamic value,
  2. TypeContext context
)
override

Implementation

fromJson(value, TypeContext context) {
  if (value == null) return null;
  var o = context.typeInfo.createInstance();
  if (value.runtimeType == o.runtimeType) {
    return value;
  }

  var toArgTypes = getGenericArgs(getTypeName(o, context));

  Map map = value;
  map.forEach((key, val) {
    o[convert(key, toArgTypes[0], context)] = convert(val, toArgTypes[1], context);
  });

  return o;
}