fromJson<T extends JSONExtendable> static method

T fromJson<T extends JSONExtendable>(
  1. Map<String, dynamic> json,
  2. T innerFromJson(
    1. Map<String, dynamic>
    ),
  3. Set<String> builtInKeys
)

Implementation

static T fromJson<T extends JSONExtendable>(
    Map<String, dynamic> json, T Function(Map<String, dynamic>) innerFromJson, Set<String> builtInKeys) {
  if (json.containsKey("custom")) {
    json["custom"] = {"custom": json["custom"]};
  } else {
    final Map<String, dynamic> custom = {};
    json["custom"] = custom;
  }

  final t = innerFromJson(json);

  json.forEach((key, value) {
    if (key != "custom" && !builtInKeys.contains(key)) {
      t.custom[key] = value;
    }
  });
  return t;
}