relatedFieldJson function

RelatedBuilder relatedFieldJson(
  1. String fieldName,
  2. dynamic json
)

This is more complicated because previously we were needing to pull the field json out into a separate root

Implementation

RelatedBuilder relatedFieldJson(String fieldName, dynamic json) {
  return (JsonObject map) {
    if (json == null ||
        (json is Map && json.isEmpty) ||
        (json is Iterable && json.isEmpty)) {
      return;
    }
    map[fieldName] = json;
  };
}