Scope class
A supply scope is a container for connected nodes
- Implementers
Constructors
-
Scope({required ScopeBluePrint bluePrint, required Scope parent, Owner<
Scope> ? owner, bool isMetaScope = false}) -
Creates a scope with a key. Key must be lower camel case.
factory
-
Scope.example({Scm? scm, String key = 'example', List<
String> aliases = const [], List<ScBuilderBluePrint> builders = const [], List<ScopeBluePrint> children = const [], bool createNode = true, List<String> smartMaster = const []}) -
Creates an example instance of Scope
factory
- Scope.metaScope({required String key, required Scope? parent})
- Instantiates the scope as a meta scope
- Scope.root({required String key, required Scm scm})
- Create a root supply scope having no parent
Properties
-
allScopes
→ Iterable<
Scope> -
Iterable to iterate over all nodes recursively
no setter
- bluePrint → ScopeBluePrint
-
The blue print of the scope
final
-
builders
→ List<
ScBuilder> -
Returns the scope inserts
no setter
-
children
→ Iterable<
Scope> -
Returns the child scopes
no setter
- depth → int
-
The depth of the scope
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → int
-
The uinquie id of the scope
final
- isDisposed → bool
-
Returns true if the scope is disposed
no setter
- isErased → bool
-
Returns true if the scope is erased
no setter
- isMetaScope → bool
-
Returns true if scope is a meta scope
final
- isSmartScope → bool
-
Returns true if this scope is a smart scope, i.e. it either has
a blue print that defines a smart master or it has a parent that is a
smart scope.
no setter
- key → String
-
The key of the scope
no setter
-
metaScopes
→ Iterable<
Scope> -
Meta scopes & nodes
Returns meta scopes. These scopes manage suppliers providing informations
about the scope.
no setter
-
nodes
→ Iterable<
Node> -
The nodes of this scope
no setter
-
onChange
↔ Node<
Scope> ? -
A node informing about changes in the scope
Is null, wenn Node.onChangeEnabled is false
latefinal
-
onChangeRecursive
↔ Node<
Scope> ? -
A node informing about changes in the scope or one of it's children
Is null, wenn Node.onRecursiveChangeEnabled is false
latefinal
-
owner
→ Owner<
Scope> ? -
Returns the owner of the scope when available
no setter
- parent ↔ Scope?
-
The parent supply scope
getter/setter pair
- path → String
-
The path of the scope
no setter
-
pathArray
→ List<
String> -
The path of the scope as array
no setter
- root → Scope
-
Returns the root scope of this scope
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scm → Scm
-
The supply chain manager
final
-
smartMaster
→ List<
String> -
Returns the smart master path of the scope
no setter
Methods
-
addChild(
ScopeBluePrint bluePrint, {Owner< Scope> ? owner}) → Scope - Adds a child scope
-
addChildren(
List< ScopeBluePrint> bluePrints, {Owner<Scope> ? owner}) → List<Scope> - Adds a number of children
-
addNode<
T> (Node< T> node) → void - Adds an existing node to the scope
-
addOBluePrintverlay(
NodeBluePrint bluePrint) → void - Add a blue print overlay on the top of an existing node
-
addOrReplaceNode<
T> (NodeBluePrint< T> bluePrint) → Node<T> - Add or replace a node with the new blue print
-
addScBuilder(
ScBuilder builder) → void - This method is called by scopeInsert to add the insert
-
builder(
String key) → ScBuilder? - Retruns the builder with given key or null if not found
-
child(
String key) → Scope? - Returns the child scope with the given key
-
commonParent(
Scope other) → Scope - Returns the common root of this and the other scope
-
deepChildren(
{int depth = 1}) → Iterable< Scope> - Returns
-
deepParents(
{int depth = 1}) → Iterable< Scope> - Returns
-
dispose(
) → void - Disposes the scope
-
dot(
{int childScopeDepth = -1, int parentScopeDepth = 0, List< Node> ? highlightedNodes, List<Scope> ? highlightedScopes}) → String - Returns a graph that can be turned into svg using graphviz
-
findChildScope(
String path) → Scope? - Returns the first scope with the given path. Throws if multiple scopes with the same path exist.
-
findDirectChildNode<
T> (List< String> path) → Node<T> ? - Returns the child node but only when it is a direct child
-
findNode<
T> (String path, {bool throwIfNotFound = false, bool skipInserts = false, List< Node< excludedNodes = const []}) → Node<T> >T> ? - Returns the node of key in this or any parent nodes
-
findOrCreateChild(
String key) → Scope - Find or create a child scope with key
-
findOrCreateNode<
T> (NodeBluePrint< T> bluePrint) → Node<T> - Returns the node with key. If not available in scope the node is created.
-
findOrCreateNodes(
List< NodeBluePrint> bluePrints, {bool applyScBuilders = true, Owner<Node> ? owner}) → List<Node> - Returns the node with key. If not available in scope the node is created.
-
findScope(
String path, {bool throwIfNotFound = false, bool skipInserts = false}) → Scope? - Returns the node of key in this or any parent nodes
-
graph(
{int childScopeDepth = -1, int parentScopeDepth = 0, List< Node> ? highlightedNodes, List<Scope> ? highlightedScopes}) → GraphScopeItem - Returns an graph
-
hasNode(
String key) → bool - Returns true if a node with the given key exists in this or a parent supply scope
-
isAncestorOf(
Scope scope) → bool - Returns true if this scope is an ancestor of the given scope
-
isDescendantOf(
Scope scope) → bool - Returns true if this scope is a descendant of the given scope
-
jsonDump(
{int parentDepth = 0, int childDepth = -1, bool sourceNodesOnly = false, bool removeEmptyScopes = false, bool throwOnNonSerializableTypes = false}) → Map< String, dynamic> - Prints all pathes of the scope or its parent
-
ls(
{int parentDepth = 0, int childDepth = -1, bool sourceNodesOnly = false, bool printProducts = false}) → List< String> - Prints all pathes of the scope or its parent
-
matchesKey(
String key) → bool - Returns true if the key matches the given key or an alias
-
matchesPath(
String path) → bool - Returns true if node matches the path
-
matchesPathArray(
List< String> pathArray) → bool - Returns true if node matches the path
-
mermaid(
{int childScopeDepth = -1, int parentScopeDepth = 0, List< Node> ? highlightedNodes, List<Scope> ? highlightedScopes}) → String - Returns a mermaid graph
-
metaScope(
String key) → Scope? - Returns the meta scope with the given key
-
metaScopeFindOrCreate(
String key) → Scope - Allows to add nodes to the meta scope
-
mockContent(
Map< String, dynamic> content) → void - Allows to mock the content of the scope
-
node<
T> (String key) → Node< T> ? - Returns the own node for a given key or null if not found
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
preset(
) → Map< String, dynamic> - Exports the current configuration of the scope as a json map.
-
removeBluePrintverlay(
NodeBluePrint bluePrint) → void - Remove an overlay added before
-
removeNode(
String key) → void - Remove the node from the scope
-
removeNodes(
List< NodeBluePrint> bluePrints) → void - Remove the nodes from the scope
-
removeScBuilder(
ScBuilder builder) → void - Removes a scope insert
-
reset(
) → void - Sets back all nodes to it's inital products
-
setPreset(
Map< String, dynamic> preset, {bool resetBefore = true, bool throwOnErrors = true, List<String> ? errors}) → void - Applies a preset to the scope
-
toString(
) → String -
Returns the node as string
override
-
writeImageFile(
String path, {int childScopeDepth = -1, int parentScopeDepth = 0, List< Node> ? highlightedNodes, List<Scope> ? highlightedScopes, double scale = 1.0, bool write2x = false, MarkdownFormat markdownFormat = MarkdownFormat.gitHub}) → Future<void> - Save the graph to a file
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
testRestIdCounter(
) → void - Reset id counter for test purposes