GraphNotifier class

A bidirected graph data structure that notifies modification events through a StateNotifier.

It's a core framework component as it holds all relationship information.

Watchers like Repository.watchAll or BelongsTo.watch make use of it.

Its public API requires all keys and metadata to be namespaced i.e. manager:key

Inheritance
Available Extensions

Constructors

GraphNotifier(HiveLocalStorage _hiveLocalStorage)

Properties

box ↔ Box<Map>?
getter/setter pair
debugState DataGraphEvent?
A development-only way to access state outside of StateNotifier.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
If a listener has been added using addListener and hasn't been removed yet.
no setterinherited
isInitialized bool
no setter
mounted bool
Whether dispose was called or not.
no setterinherited
onDispose Function?
getter/setter pairinherited
onError ErrorListener?
A callback for error reporting if one of the listeners added with addListener throws.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state DataGraphEvent?
The current "state" of this StateNotifier.
getter/setter pairinherited
stream Stream<DataGraphEvent?>
A broadcast stream representation of a StateNotifier.
no setterinherited

Methods

addEdge(String from, String to, {required String metadata, String? inverseMetadata, bool notify = true}) → void
Adds a bidirectional edge:
addEdges(String from, {required String metadata, required Iterable<String> tos, String? inverseMetadata, bool notify = true}) → void
See addEdge
addListener(void listener(DataGraphEvent), {bool fireImmediately = true}) RemoveListener
Subscribes to this object.
inherited
addNode(String key, {bool notify = true}) → void
Adds a node, key MUST be namespaced (e.g. manager:key)
addNodes(Iterable<String> keys, {bool notify = true}) → void
Adds nodes, all keys MUST be namespaced (e.g. manager:key)
clear() Future<void>
debugAssert(bool value) → void
dispose() → void
Frees all the resources associated to this object.
override
getEdge(String key, {required String metadata}) List<String>
Returns edge by metadata
getIdForKey(String key) String?
Finds an ID in the graph, given a key.
getKeyForId(String type, dynamic id, {String? keyIfAbsent}) String?
Finds a model's key in the graph.
getNode(String key) Map<String, List<String>>?
Obtains a node, key MUST be namespaced (e.g. manager:key)
hasEdge(String key, {required String metadata}) bool
Returns whether the requested edge is present in this graph.
hasNode(String key) bool
Returns whether key is present in this graph.
initialize() Future<GraphNotifier>
Initializes Hive local storage and box it depends on
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeEdge(String from, String to, {required String metadata, String? inverseMetadata, bool notify = true}) → void
Removes a bidirectional edge:
removeEdges(String from, {required String metadata, Iterable<String>? tos, String? inverseMetadata, bool notify = true}) → void
See removeEdge
removeId(String type, dynamic id) → void
Removes type/id (and its edges) from graph
removeKey(String key) → void
Removes key (and its edges) from graph
removeNode(String key) → void
Removes a node, key MUST be namespaced (e.g. manager:key)
removeOrphanNodes() → void
Removes orphan nodes (i.e. nodes without edges)
toMap() Map<String, Map>
Returns a Map representation of this graph, the underlying Hive box.
toString() String
A string representation of this object.
inherited
updateShouldNotify(DataGraphEvent? old, DataGraphEvent? current) bool
Whether to notify listeners or not when state changes
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited