Node<T> constructor

Node<T>(
  1. T data, [
  2. Vector2? position
])

Construct a Node instance from a given data of type T.

Optionally a position can be provided, otherwise a random position is generated.

Implementation

Node(this.data, [Vector2? position])
    : position = position ?? (Vector2.random() - Vector2(0.5, 0.5)) * 200;