keyFields property

Map<String, dynamic>? keyFields
final

Allows defining the primary key fields for this type.

Pass a true value for any fields you wish to use as key fields. You can also use child fields.

const bookTypePolicy = TypePolicy(
  keyFields: {
    'title': true,
    'author': {
      'name': true,
    }
  },
);

If you don't wish to normalize this type, simply pass an empty Map. In that case, we won't normalize this type and it will be reachable from its parent.

Implementation

final Map<String, dynamic>? keyFields;