utils library

Classes

AddTypenameVisitor
FieldKey
A utility class for stringifying a field plus variables.
NormalizationConfig

Properties

defaultRootTypenames Map<OperationType, String>
final

Functions

allRootTypenames(Map<String, TypePolicy> typePolicies) Set<String>
argsWithValues(Map<String, dynamic> variables, Iterable<ArgumentNode> arguments) SplayTreeMap<String, dynamic>
deepMerge(Map<String, dynamic> object, Map<String, dynamic> other) Map<String, dynamic>
Deeply merges nested properties, returning a new Map.
findFragmentInFragmentMap({required Map<String, FragmentDefinitionNode> fragmentMap, String? fragmentName}) → FragmentDefinitionNode
getFragmentMap(DocumentNode document) Map<String, FragmentDefinitionNode>
getOperationDefinition(DocumentNode document, String? operationName) → OperationDefinitionNode
Returns the AST Node for the GraphQL Operation.
identify(Map data, {String referenceKey = kDefaultReferenceKey, Map<String, TypePolicy> typePolicies = const {}, DataIdResolver? dataIdFromObject}) String?
Returns the canonical ID for a given object or reference.
isDanglingReference(Object? data, NormalizationConfig config) bool
Determines whether the given data is a reference that points to a non-existent object.
keyFieldsWithArgs(Map<String, dynamic> keyFields, Map data) SplayTreeMap<String, dynamic>
operationFieldNames<TData, TVars>(DocumentNode document, String operationName, Map<String, dynamic> vars, Map<String, TypePolicy> typePolicies, Map<String, Set<String>> possibleTypes) List<String>
Returns the root field names for a given operation.
reachableIds(Map<String, dynamic>? read(String dataId), [Map<String, TypePolicy> typePolicies = const {}, String referenceKey = kDefaultReferenceKey]) Set<String>
Returns a set of dataIds that can be reached by any root query.
reachableIdsFromDataId(String dataId, Map<String, dynamic>? read(String dataId), [String referenceKey = kDefaultReferenceKey]) Set<String>
Returns a set of all IDs reachable from the given data ID.
resolveDataId({required Map<String, dynamic> data, required Map<String, TypePolicy> typePolicies, DataIdResolver? dataIdFromObject}) String?
Returns a unique ID to use to reference this normalized object.
resolveRootTypename(OperationDefinitionNode operationDefinition, Map<String, TypePolicy> typePolicies) String
typenameForOperationType(OperationType operationType, Map<String, TypePolicy> typePolicies) String
validateFragmentDataStructure({required DocumentNode document, required Map<String, dynamic>? data, String? fragmentName, Map<String, dynamic> variables = const {}, bool addTypename = false, bool handleException = false}) bool
Validates the structure of data against the fragment fragmentName in document.
validateOperationDataStructure({required DocumentNode document, required Map<String, dynamic>? data, String? operationName, Map<String, dynamic> variables = const {}, bool addTypename = false, bool handleException = false}) bool
Validates the structure of data against the operation operationName in document.

Typedefs

DataIdResolver = String? Function(Map<String, dynamic> object)
SelectionSetFinder = SelectionSetNode Function({required DocumentNode document, required Map<String, FragmentDefinitionNode> fragmentMap})