withFieldResource<T2 extends Resource> method

T withFieldResource<T2 extends Resource>(
  1. FieldDefinition<T2> field,
  2. T2 resource, {
  3. required T constructor(
    1. JsonObject
    ),
})

Creates a clone of the resource with the provided field updated with another resource

Implementation

T withFieldResource<T2 extends Resource>(
  FieldDefinition<T2> field,
  T2 resource, {
  required T Function(JsonObject) constructor,
}) =>
    constructor(json.withUpdate(field.name, resource.json));