KnowledgeSearchPolicy constructor

KnowledgeSearchPolicy({
  1. bool currentOnly = false,
  2. DateTime? asOf,
  3. Set<OkfLifecycleStatus>? statuses,
  4. Set<String> conceptTypes = const {},
  5. Set<String> pathPrefixes = const {},
  6. bool expandRelationships = false,
  7. Map<String, String> governingSources = const {},
})

Implementation

KnowledgeSearchPolicy({
  this.currentOnly = false,
  this.asOf,
  Set<OkfLifecycleStatus>? statuses,
  Set<String> conceptTypes = const {},
  Set<String> pathPrefixes = const {},
  this.expandRelationships = false,
  Map<String, String> governingSources = const {},
}) : statuses = statuses == null ? null : Set.unmodifiable(statuses),
     conceptTypes = Set.unmodifiable(conceptTypes),
     pathPrefixes = Set.unmodifiable(pathPrefixes),
     governingSources = Map.unmodifiable(governingSources) {
  if (currentOnly && asOf == null) {
    throw ArgumentError('currentOnly requires an explicit asOf date.');
  }
  for (final start in governingSources.keys) {
    final visited = <String>{};
    String? path = start;
    while (path != null) {
      if (!visited.add(path)) {
        throw ArgumentError('Cyclic governing sources: $start');
      }
      path = governingSources[path];
    }
  }
}