Body class

Annotations
  • @JsonSerializable.new()

Constructors

Body({@JsonKey.new(name: 'parts') List<BodyPart> parts = const []})
const
Body.fromJson(Map<String, dynamic> json)
Deserializes a JSON map into a Body object.
factory
Body.initial()
Creates a default body structure.
factory

Properties

allPartsById → Map<String, BodyPart>
A helper getter to provide a flattened map of all body parts, keyed by their ID.
no setter
hashCode → int
The hash code for this object.
no setterinherited
painfulParts → List<BodyPart>
A helper getter to find all parts with a pain level greater than 0.
no setter
parts → List<BodyPart>
final
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
toJson() → Map<String, dynamic>
Serializes this Body object into a JSON map.
toString() → String
A string representation of this object.
inherited
withPain(String partId, BodyPain newPain) → Body
Returns a new Body object with the pain details updated for a specific part. Because the class is immutable, this method is the proper way to update state.
withPainLevel(String partId, int painLevel) → Body

Operators

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

Constants

maxPainLevel → const int
The maximum pain level that can be assigned to a body part.