SimulationBody class

Immutable simulation body state.

Constructors

SimulationBody({required String id, required double mass, required double radius, required Vec2 position, required Vec2 velocity, required int colorValue, String? label, String? kind, bool alive = true})
Creates a simulation body.
const
SimulationBody.fromJson(Map<String, dynamic> json)
Deserializes a body from JSON.
factory

Properties

alive → bool
Whether body is active in simulation.
final
colorValue → int
Body ARGB color value.
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
Stable body identifier.
final
kind → String?
Optional kind/category tag.
final
label → String?
Optional human-readable label.
final
mass → double
Body mass value.
final
position → Vec2
Body position vector.
final
radius → double
Body render/collision radius.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
velocity → Vec2
Body velocity vector.
final

Methods

copyWith({String? id, String? label, String? kind, double? mass, double? radius, Vec2? position, Vec2? velocity, int? colorValue, bool? alive}) → SimulationBody
Returns a copy with selected fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Serializes this body to JSON.
toString() → String
A string representation of this object.
inherited
validate() → String?
Validates body values and returns an error message if invalid.

Operators

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