ObjectPool class

Inspired by web.archive.org/web/20121106084117/http://www.dartgamedevs.org/2012/11/free-lists-for-predictable-game.html this class stores objects that are no longer used in the game for later reuse.

Constructors

ObjectPool()

Properties

hashCode int
The hash code for this object.
no setterinherited
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
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

add<T extends Pooled<T>>(T pooled) → void
Adds a Pooled object to the ObjectPool.
addMany<T extends Pooled<T>>(CreatePooled<T> createPooled, int amount) → void
Add a specific amount of Pooleds for later reuse.
get<T extends Pooled<T>>(CreatePooled<T> createPooled) → T
Returns a pooled object of type T. If there is no object in the pool it will create a new one using createPooled.