PublishedState class final
What one step left for the view to read: immutable, built in the
publish phase.
Encoded, not shared. Each published component is held as its codec wrote it, and each event as its declared codec wrote it, so nothing the view holds can be changed by the next step, and the same state crosses an isolate boundary as plain values. read decodes a component on demand; positions are decoded once, since the view reads every one of them every frame; PublishedEvent.decode reads an event back.
Positions in double precision. positions are WorldPositions; origin is the floating origin the simulation's float32 work is relative to (see OriginShifted).
Constructors
-
PublishedState({required int step, required double seconds, WorldPosition origin = WorldPosition.origin, Map<
String, Map< components = const <String, Map<Entity, Object?>>{}, Map<Entity, Object?> >Entity, WorldPosition> positions = const <Entity, WorldPosition>{}, List<PublishedEvent> events = const <PublishedEvent>[], SimulationVersion simulation = SimulationVersion.engineOnly, List<ProbeReading> probes = const <ProbeReading>[]}) -
What step
stepleft, atsecondsseconds of simulated time. The collections are copied unmodifiable; what is not given is empty, the origin is WorldPosition.origin andsimulationis the engine's alone. - PublishedState.fromWire(Object? wire)
-
Reads what toWire wrote. Throws a PluginFormatException for a value
that is not one: a state read halfway would draw a world that never
was.
factory
Properties
-
components
→ Map<
String, Map< Entity, Object?> > -
Every published component, by codec id, then by entity, as its codec
encoded it.
final
-
events
→ List<
PublishedEvent> -
The step channel's events of the steps since the last publication, in
order and encoded: what the view plays sounds and particles for.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- origin → WorldPosition
-
The world origin the simulation's local frame was at.
final
-
positions
→ Map<
Entity, WorldPosition> -
Every entity with a published WorldPosition, where it is.
final
-
probes
→ List<
ProbeReading> -
What every probe in the simulation read at the end of step, in the
order the probes were read: what a chart or a gauge shows, read here
rather than off the world.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seconds → double
-
Simulated seconds when this was published.
final
- simulation → SimulationVersion
-
The simulation that produced this.
final
- step → int
-
The number of steps run when this was published.
final
Methods
-
entitiesWith(
ComponentCodec< Object> codec) → Iterable<Entity> -
The entities carrying the published component
codecwrites, in ascending index order: what a view plugin or a tool walks to draw or list one kind of thing. -
eventsNamed(
String name) → Iterable< PublishedEvent> -
The events named
name, in order: what a view that answers one kind of event walks. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
positionOf(
Entity entity) → WorldPosition? -
Where
entityis; null when it publishes no position (absent). -
probe(
String id) → ProbeReading? -
What the probe
idread, or null when no probe of that id was read (absent). -
read<
T extends Object> (ComponentCodec< T> codec, Entity entity) → T? -
The component
codecwrites, onentity, decoded; null when the entity has none published (absent). -
toString(
) → String -
A string representation of this object.
override
-
toWire(
) → Map< String, Object?> -
This state as plain values — lists, maps of strings, numbers, strings,
booleans and null — which is what crosses an isolate's port or a
socket:
IsolateSimulationinflutter3d_simsends every published state this way. PublishedState.fromWire reads it back.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- empty → PublishedState
-
Before the first step: nothing published.
final