parse method

void parse(
  1. Map<String, dynamic> json, {
  2. bool strict = true,
})

Parse a json map into this object. If strict is true, then an exception will be thrown if the json map does not contain a key that this object expects.

Implementation

void parse(Map<String, dynamic> json, {bool strict = true}) {
  for (final key in keys) {
    if (json.containsKey(key.key)) {
      key.parse(json[key.key]);
    } else if (strict) {
      throw FormatException('Json does not contain key ${key.key}', json);
    }
  }
}