NodePool class Gameplay kit

High-performance object recycler for transient nodes (projectiles, damage numbers, effects).

Constructors

NodePool(Node factory(), {int initialSize = 8, int maxSize = 128})
Creates a node pool, pre-warming initialSize idle instances.

Properties

activeCount int
Number of currently active spawned nodes.
no setter
factory Node Function()
Factory function creating a new node instance when the idle pool is exhausted.
final
hashCode int
The hash code for this object.
no setterinherited
idleCount int
Number of pre-warmed idle nodes ready for immediate reuse.
no setter
maxSize int
Maximum number of idle nodes retained in the pool for reuse.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
totalCount int
Total count of managed nodes (active + idle).
no setter

Methods

despawn(Node node) → void
Returns node back to the idle pool, removing it from its parent.
despawnAll() → void
Despawns all active nodes managed by this pool.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
spawn({Node? parent, Matrix4? transform, void onSpawn(Node node)?}) Node
Acquires a node from the pool and attaches it to parent.
toString() String
A string representation of this object.
inherited

Operators

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