reachableIds function

Set<String> reachableIds(
  1. Map<String, dynamic>? read(
    1. String dataId
    ), [
  2. Map<String, TypePolicy> typePolicies = const {},
  3. String referenceKey = kDefaultReferenceKey
])

Returns a set of dataIds that can be reached by any root query.

Implementation

Set<String> reachableIds(
  Map<String, dynamic>? Function(String dataId) read, [
  Map<String, TypePolicy> typePolicies = const {},
  String referenceKey = kDefaultReferenceKey,
]) =>
    defaultRootTypenames.keys
        .map(
      (type) => typenameForOperationType(
        type,
        typePolicies,
      ),
    )
        .fold(
      {},
      (ids, rootTypename) => ids
        ..add(rootTypename)
        ..addAll(
          _idsInObject(
            read(rootTypename),
            read,
            referenceKey,
            {},
          ),
        ),
    );