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.watchAllNotifier 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(Ref<Object?> ref)

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
ref Ref<Object?>
final
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 addNode = false, bool notify = true}) → void
Adds a bidirectional edge:
addEdges(String from, {required String metadata, required Iterable<String> tos, String? inverseMetadata, bool addNode = false, 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>
compact({required List<String> removeTypes}) → void
This will remove all non-referenced key/ID entries in the graph for certain types. Typically used after clear()ing one or more types in local storage. USE WITH CAUTION!
debugAssert(bool value) → void
debugMap() → void
dispose() → void
Frees all the resources associated with this object.
override
getEdge(String key, {required String metadata}) List<String>
Returns edge by metadata
getIdForKey(String key) Object?
Finds an ID in the graph, given a key.
getKeyForId(String type, Object? id, {String? keyIfAbsent}) String?
Finds a model's key in the graph.
getNode(String key, {bool orAdd = false, bool notify = true}) Map<String, List<String>>?
Obtains a node
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 = const [], String? inverseMetadata, bool notify = true}) → void
See removeEdge
removeId(String type, Object id, {bool notify = true}) → void
Removes type/id (and its edges) from graph
removeKey(String key) → void
Removes key (and its edges) from graph
removeNode(String key, {bool notify = true}) → void
Removes a node, key MUST be namespaced (e.g. manager:key)
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