SkeletonData class

Skeleton data loaded from a skeleton .json or .skel file. Contains bones, slots, constraints, skins, animations, and so on making up a skeleton. Also contains meta data such as the skeletons setup pose bounding box, the Spine editor version it was exported from, and so on.

Skeleton data is stateless. Stateful Skeleton instances can be constructed from a SkeletonData instance. A single SkeletonData instance can be shared by multiple Skeleton instances.

Use the static methods fromJson, fromBinary, fromAsset, fromFile, and fromURL to load skeleton data. Call dispose when the skeleton data is no longer in use to free its resources.

See Data objects in the Spine Runtimes Guide.

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

dispose() → void
Disposes the (native) resources of this skeleton data. The skeleton data can no longer be used after calling this function. Only the first call to this method will have an effect. Subsequent calls are ignored.
findAnimation(String name) Animation?
Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to call it multiple times.
findBone(String name) BoneData?
Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it multiple times.
findEvent(String name) EventData?
Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it multiple times.
findIkConstraint(String name) IkConstraintData?
Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
findPathConstraint(String name) PathConstraintData?
Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
findSkin(String name) Skin?
Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it multiple times.
findSlot(String name) SlotData?
Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it multiple times.
findTransformConstraint(String name) TransformConstraintData?
Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of this method than to call it multiple times.
getAnimations() List<Animation>
The skeleton's animations.
getAudioPath() String?
The path to the audio directory as defined in Spine, or null if nonessential data was not exported.
getBones() List<BoneData>
The skeleton's bones, sorted parent first. The root bone is always the first bone.
getDefaultSkin() Skin?
The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
getEvents() List<EventData>
The skeleton's events.
getFps() double
The dopesheet FPS in Spine, or zero if nonessential data was not exported.
getHash() String?
The skeleton data hash. This value will change if any of the skeleton data has changed.
getHeight() double
The height of the skeleton's axis aligned bounding box in the setup pose.
getIkConstraints() List<IkConstraintData>
The skeleton's IK constraints.
getImagesPath() String?
The path to the images directory as defined in Spine, or null if nonessential data was not exported.
getName() String?
The skeleton's name, which by default is the name of the skeleton data file when possible, or null when a name hasn't been set.
getPathConstraints() List<PathConstraintData>
The skeleton's path constraints.
getSkins() List<Skin>
All skins, including the default skin.
getSlots() List<SlotData>
The skeleton's slots.
getTransformConstraints() List<TransformConstraint>
The skeleton's transform constraints.
getVersion() String?
The Spine version used to export the skeleton data.
getWidth() double
The width of the skeleton's axis aligned bounding box in the setup pose.
getX() double
The X coordinate of the skeleton's axis aligned bounding box in the setup pose.
getY() double
The Y coordinate of the skeleton's axis aligned bounding box in the setup pose.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setDefaultSkin(Skin? skin) → void
setHeight(double height) → void
setWidth(double width) → void
setX(double x) → void
setY(double y) → void
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromAsset(Atlas atlas, String skeletonFile, {AssetBundle? bundle}) Future<SkeletonData>
Loads a SkeletonData from the file skeletonFile in the root bundle or the optionally provided bundle. Uses the provided atlas to resolve attachment images.
fromBinary(Atlas atlas, Uint8List binary) SkeletonData
Loads a SkeletonData from the binary skeleton data, using the provided atlas to resolve attachment images.
fromFile(Atlas atlas, String skeletonFile) Future<SkeletonData>
Loads a SkeletonData from the file skeletonFile. Uses the provided atlas to resolve attachment images.
fromHttp(Atlas atlas, String skeletonURL) Future<SkeletonData>
Loads a SkeletonData from the URL skeletonURL. Uses the provided atlas to resolve attachment images.
fromJson(Atlas atlas, String json) SkeletonData
Loads a SkeletonData from the json string, using the provided atlas to resolve attachment images.