gqlifyField<T> function

T gqlifyField<T>(
  1. Map<String, Object?> json,
  2. String key,
  3. GqlifyDecoder<T> decoder
)

Reads json[key] with decoder, adding key to the path of failures.

Implementation

T gqlifyField<T>(
    Map<String, Object?> json, String key, GqlifyDecoder<T> decoder) {
  try {
    return decoder.decode(json[key]);
  } on GqlifyDecodeError catch (e) {
    throw e._at(key, missing: !json.containsKey(key));
  }
}