DocumentReader class

DocumentReader reads generated boomsheets anim docs and parses them.

Each Anim represents a state and has a collection of Keyframes. Their lines are identified by the keyword anim. Each line that follows can be a Keyframe, identified by keyword frame, or the next anim state. A list of Points are identified by the keyword point and end when the next frame keyword or anim keywords are reached. Point's are optional but if one Keyframe has a Point label, then all Keyframes in that state are expected to have an identically-named Point label. Otherwise the document is considered ill-formed with the official editor. Finally, there is a special Keyframe keyword empty that holds no size or origin data.

An example doc might look like this:

anim punch
frame dur=3f x=0 y=129 w=64 h=64 originx=0 originy=0
frame dur=3f x=32 y=129 w=64 h=64 originx=0 originy=0
frame dur=8f x=64 y=129 w=64 h=64 originx=0 originy=0

anim kick
frame dur=8f x=128 y=500 w=120 h=66 originx=0 originy=0
... etc ...

All of the parsing and value-checking are performed for you. As such, there are only two static public utility methods:

  1. DocumentReader.fromString reads a String of the document's contents. The string expects the new-line characters to remain as line-terminators.

  2. DocumentReader.fromFile reads a File asynchronously.

Both methods return the final Document. To handle errors, pass in a ParserErrorHandler callback function.

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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

fromFile(File file, {ParserErrorHandler? onErrors}) Future<Document>
fromString(String body, {ParserErrorHandler? onErrors}) Document