writeResponse method
Merges a GraphQL response data object. Objects the Normalization
identifies are stored once as entities and referenced; the rest is
merged inline. Returns the dependency keys touched (the ones whose
value changed). When at is given, every key the response wrote —
changed or not — is stamped with it (see fetchedAt).
Implementation
@override
Set<String> writeResponse(
String operation,
Map<String, Object?> data, {
DateTime? at,
}) {
final touched = <String>{};
final written = at == null ? null : <String>{};
_writing = written;
try {
_mergeEntity(rootKey(operation), data, touched);
} finally {
_writing = null;
}
if (written != null) {
for (final key in written) {
_fetchedAt[key] = at!;
}
}
_emit(touched);
return touched;
}