World class
ECS World - Manages all entities and systems
The central manager for the Entity-Component System. Entities are stored in Archetype tables grouped by component signature, giving systems cache-friendly iteration over matching entities.
- Available extensions
Constructors
- World()
Properties
-
activeEntities
→ Iterable<
Entity> -
Get active entities
no setter
- commands → CommandBuffer
-
Deferred command buffer for safe structural mutations during iteration.
latefinal
-
entities
→ UnmodifiableListView<
Entity> -
Get all entities
no setter
- events → EventBus
-
Event bus for decoupled inter-system communication.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stats
→ Map<
String, dynamic> -
Get statistics
no setter
-
systems
→ UnmodifiableListView<
System> -
Get all systems
no setter
Methods
-
addSystem(
System system) → void - Add a system to the world
-
clearSystems(
) → void - Remove all systems from the world.
-
createEntity(
{String? name}) → Entity - Create a new entity
-
createEntityWithComponents(
List< Component> components, {String? name}) → Entity - Create an entity with components (batch — avoids per-component archetype migrations).
-
destroyAllEntities(
) → void - Destroy all entities
-
destroyEntity(
Entity entity) → void - Destroy an entity
-
dispose(
) → void - Dispose the world and all systems
-
findEntityByName(
String name) → Entity? - Find entity by name
-
getEntity(
EntityId id) → Entity? - Get entity by ID (O(1) lookup).
-
getSystem<
T extends System> () → T? - Get a system by type
-
initialize(
) → void - Initialize the world
-
instantiate(
EntityPrefab prefab) → Entity -
Create a new entity from a
prefabblueprint. -
isEntityAlive(
Entity entity) → bool -
Check whether
entityis still the live instance for its id slot. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
query(
List< Type> componentTypes) → List<Entity> - Find entities with specific components.
-
queryArchetypes(
List< Type> componentTypes) → Iterable<Archetype> -
Return all Archetypes whose component set is a superset of
componentTypes. -
removeSystem(
System system) → void - Remove a system from the world
-
render(
Canvas canvas, Size size) → void - Render all active systems
-
toSignal(
{String? debugLabel}) → WorldSignal -
Available on World, provided by the ReactiveWorldExtension extension
Creates a reactive signal wrapper for this world. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
double deltaTime) → void - Update all active systems
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited