Node class abstract

Abstract base class for nodes in the graph database.

A node represents a vertex in the graph structure. All nodes must have a unique identifier (id) and be able to serialize themselves to JSON. Implement this class to create custom node types for your graph database.

Example:

class PersonNode extends Node {
  final String name;
  final int age;

  PersonNode({
    required String id,
    required this.name,
    required this.age,
  }) : super(id: id);

  @override
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': name,
      'age': age,
    };
  }
}

Constructors

Node({required String id})
Creates a new node with the specified id.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
The unique identifier for this node.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this node to a JSON representation.
toString() String
A string representation of this object.
inherited

Operators

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